1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-23 01:44:22 +00:00

win32 midi sysex fix.

This commit is contained in:
jules 2013-04-19 09:40:10 +01:00
parent b2ce00db31
commit 5c77abb41e

View file

@ -81,7 +81,10 @@ public:
activeMidiCollectors.addIfNotAlreadyThere (this);
for (int i = 0; i < (int) numHeaders; ++i)
{
headers[i].prepare (deviceHandle);
headers[i].write (deviceHandle);
}
startTime = Time::getMillisecondCounterHiRes();
MMRESULT res = midiInStart (deviceHandle);
@ -139,29 +142,15 @@ private:
class MidiHeader
{
public:
MidiHeader()
MidiHeader() {}
void prepare (HMIDIIN deviceHandle)
{
zerostruct (hdr);
hdr.lpData = data;
hdr.dwBufferLength = (DWORD) numElementsInArray (data);
}
void write (HMIDIIN deviceHandle)
{
hdr.dwBytesRecorded = 0;
MMRESULT res = midiInPrepareHeader (deviceHandle, &hdr, sizeof (hdr));
res = midiInAddBuffer (deviceHandle, &hdr, sizeof (hdr));
(void) res;
}
void writeIfFinished (HMIDIIN deviceHandle)
{
if ((hdr.dwFlags & WHDR_DONE) != 0)
{
MMRESULT res = midiInUnprepareHeader (deviceHandle, &hdr, sizeof (hdr));
(void) res;
write (deviceHandle);
}
midiInPrepareHeader (deviceHandle, &hdr, sizeof (hdr));
}
void unprepare (HMIDIIN deviceHandle)
@ -176,6 +165,18 @@ private:
}
}
void write (HMIDIIN deviceHandle)
{
hdr.dwBytesRecorded = 0;
midiInAddBuffer (deviceHandle, &hdr, sizeof (hdr));
}
void writeIfFinished (HMIDIIN deviceHandle)
{
if ((hdr.dwFlags & WHDR_DONE) != 0)
write (deviceHandle);
}
private:
MIDIHDR hdr;
char data [256];