DirectX SDK |
Latency is the delay between the time at which the port receives a musical message and the time at which it has synthesized enough of a wave to play. The IDirectMusicPerformance::GetLatencyTime method retrieves the current time plus the latency for the performance as a whole. This is the largest value returned by any of the ports' latency clocks.
The bumper is an extra amount of time allotted for code to run between the time that a musical event is put into the port buffer and the time that the port starts to process it. By default, the bumper length is 50 milliseconds. An application can change this value by using the IDirectMusicPerformance::SetBumperLength method, and retrieve the current value by calling IDirectMusicPerformance::GetBumperLength.
Latency time and bumper time can be combined. Suppose an event is supposed to play at 10,000 milliseconds. The latency of the port is known to be 100 ms, and the bumper length is at its default value of 50 ms. The performance therefore places the message into the port buffer at 9,850 ms.
Once a message has been placed in the port buffer, it no longer belongs to the performance and cannot be stopped from playing by using the IDirectMusicPerformance::Invalidate or the IDirectMusicPerformance::Stop method. The first message that can be invalidated has a time stamp equal to or greater than the current time plus the latency time and the bumper time. This value can be retrieved by using the IDirectMusicPerformance::GetQueueTime method.
Latency is the delay between the time at which the port receives a musical message and the time at which it has synthesized enough of a wave to play. The DirectMusicPerformance.GetLatencyTime method retrieves the current time plus the latency for the performance as a whole. This is the largest value returned by any of the ports' latency clocks.
The bumper is an extra amount of time allotted for code to run between the time that a musical event is put into the port buffer and the time that the port starts to process it. By default, the bumper length is 50 milliseconds. An application can change this value by using the DirectMusicPerformance.SetBumperLength method, and retrieve the current value by calling DirectMusicPerformance.GetBumperLength.
Latency time and bumper time can be combined. Suppose an event is supposed to play at 10,000 milliseconds. The latency of the port is known to be 100 ms, and the bumper length is at its default value of 50 ms. The performance therefore places the message into the port buffer at 9,850 ms.
Once a message has been placed in the port buffer, it no longer belongs to the performance and cannot be stopped from playing by using the DirectMusicPerformance.Invalidate or the DirectMusicPerformance.Stop method. The first message that can be invalidated has a time stamp equal to or greater than the current time plus the latency and bumper time. This value can be retrieved by using the DirectMusicPerformance.GetQueueTime method.
The following illustration illustrates the relationship of the times and durations retrieved by various methods. The current time is at the left, and the last time for which messages have been prepared is at the right. Prepare time is only an approximation of the total timespan of messages in the queue at any given moment.
The methods in the illustration are from the C++ API, but most have the same names in DirectX for Visual Basic. For example, IDirectMusicPerformance::GetPrepareTime is equivalent to DirectMusicPerformance.GetPrepareTime. The GetTime method in the illustration is equivalent to DirectMusicPerformance.GetClockTime.