Skip to content

Commit

Permalink
Re-enable scheduled messages
Browse files Browse the repository at this point in the history
Also updated TAEF to only pass if we're within 0.1ms of the target timestamp. We'll want to do better than that in time, but for now, that's not bad.  That's one tenth of a millisecond (100 microseconds).
  • Loading branch information
Psychlist1972 committed Feb 14, 2024
1 parent 6cbc5bf commit e97a449
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/staging/version/BundleInfo.wxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Include>
<?define SetupVersionName="Developer Preview 5" ?>
<?define SetupVersionNumber="1.0.24044.1931" ?>
<?define SetupVersionNumber="1.0.24044.1942" ?>
</Include>
1 change: 1 addition & 0 deletions docs/endpoints/virtual-loopback.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Each loopback endpoint pair is identified by a GUID for the association id. The
| (endpoint) description | Optional. This becomes the transport-supplied description for the loopback endpoint. |
| (endpoint) uniqueId | Required. This is a short (32 characters or fewer) case-insensitive unique Id for the endpoint. When combined with the loopback A/B prefixes in the service, it must be unique across all loopback endpoints in Windows. You can use the same unique id for each endpoint in the same pair, but not the same as other pairs. |

> Note: Loopback endpoints created in the configuration file cannot be removed by the API. Only loopback endpoints created via the API can be removed via the API. This is by design to help avoid applications changing user configuration.
# Implementation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ void MidiMessageSchedulerTests::TestScheduledMessagesTiming(uint16_t const messa


// calculate an acceptable timestamp offset
uint32_t acceptableTimestampDeltaMicroseconds = 200; // 0.2ms
// We'll likely want to do better than this in the future, but 100 microseconds for scheduling isn't bad.
uint32_t acceptableTimestampDeltaMicroseconds = 100; // 0.1ms

uint64_t acceptableTimestampDeltaTicks = (acceptableTimestampDeltaMicroseconds * MidiClock::TimestampFrequency()) / 1000000;
uint64_t acceptableTimestampDeltaTicks = (uint64_t)((acceptableTimestampDeltaMicroseconds * MidiClock::TimestampFrequency()) / 1000000.0);


std::cout << "Acceptable timestamp delta is +/- " << std::dec << acceptableTimestampDeltaTicks << " ticks" << std::endl;
Expand Down Expand Up @@ -111,6 +112,11 @@ void MidiMessageSchedulerTests::TestScheduledMessagesTiming(uint16_t const messa
auto sendResult = connSend.SendMessageWords(MidiClock::OffsetTimestampByMilliseconds(MidiClock::Now(), scheduledTimeStampOffsetMS), word);

VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(sendResult));

// if we don't sleep here, the send and receive, and the TAEF output, get in the
// way of each other and mess up timing. That's entirely a client-side problem
// and isn't how "normal" apps would work anyway.
Sleep(1);
}

std::cout << "Waiting for response" << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,10 @@ CMidi2SchedulerMidiTransform::SendMidiMessage(
}
else
{
// bypass scheduling for a stable release
auto hr = SendMidiMessageNow(data, size, timestamp);
return hr;
//// bypass scheduling for a stable release
//auto hr = SendMidiMessageNow(data, size, timestamp);
//return hr;

#if false
// otherwise, we schedule the message

if (size >= MINIMUM_UMP_DATASIZE && size <= MAXIMUM_UMP_DATASIZE)
Expand Down Expand Up @@ -281,8 +280,6 @@ CMidi2SchedulerMidiTransform::SendMidiMessage(
// invalid data size
return HR_E_MIDI_SENDMSG_INVALID_MESSAGE;
}
#endif

}

// return S_OK;
Expand Down

0 comments on commit e97a449

Please sign in to comment.