Copyright © 2005-2008 MultiMedia Soft 
Return to Table of contents  
 
How to deal with latency 
 
By default this control creates a DirectSound buffer that will host 500 milliseconds of song during the decoding/playback phase: this setting will usually work with most of the available sound card drivers but it's not optimised for the latest sound card drivers available on the market that can deal with smaller buffers without breaking-up the song during playback: the smaller the DirectSound buffer, the smaller will result the latency time when applying new equaliser values, when seeking to a new song position or when changing other stuffs like Volume, Tempo and Playback Rate. 
 
In order to change the default DirectSound buffer size, you can use the BufferLength property: it's value, expressed in milliseconds, can be in the range 100 - 5000: higher or lower values will be automatically cut to the nearest supported value. 
 
Usually the latest sound card drivers will allow the use of a 200 milliseconds buffer size, but how can you determine which value will give you the smaller latency without breaking-up the playing song? 
  • First of all you need to tell the control to perform, when initialised at Runtime, a check of the sound card drivers latency: in order to perform this check you need to set at Design-time the CheckOutputDevicesLatency property to TRUE: changes to this property made at Runtime will be simply ignored. Note that this setting will require the InitSoundSystem method a longer time to execute. 
  • At this point you can call the GetOutputDeviceLatency method on one of the available output devices in order to know its latency (expressed in milliseconds) and the GetOutputDeviceMinBufferLength method in order to know which is the minimal supported size of the DirectSound buffer (expressed in milliseconds); note that, in some case, it could happen that the reported minimal size will not work as expected when set into the BufferLength property: usually this behaviour is caused by an outdated sound card driver which can be usually fixed downloading a driver update from the sound card manufacturer. 
  • At Runtime, the BufferLength property can be changed at any time but will be effective only after loading a new song. 
     
    It's also important to note that, if the target PC has more than one sound card, you won't have the possibility to have a different buffer length for each of them. 
     
     
     
     
     
     
     
     
     
    Copyright © 2005-2008 MultiMedia Soft 
    Return to Table of contents