Microsoft DirectX 8.1 (Visual Basic) |
Before a band can be used, the instruments it references must be downloaded to the performance. This step maps the instruments to
By default, the application is responsible for downloading any band it uses. However, you can turn on automatic downloading of bands.
Downloading a band makes the band available to the performance but does not perform any program changes. Program changes take place in response to messages generated by the segment's band track, which is typically authored into a segment file. For information on how to make program changes at run time, see Making Band Changes Programmatically.
Information about how to implement downloading and unloading of bands is contained in the following topics:
When automatic downloading is on, the instruments in the band are downloaded when the segment containing the band is cued. The instruments are automatically unloaded when the segment is stopped, unless another segment using the same instruments is cued to play immediately or is currently playing.
Automatic downloading should be used only when the timing of segment starts is not critical. Repeated loading and unloading of instruments takes time and can cause serious degradation of performance in complex audio environments.
Automatic unloading, which is part of the automatic downloading mechanism, can also lead to undesired results. For example, suppose you play a short secondary segment that changes the instrument on a channel. The instrument is automatically downloaded when the secondary segment starts, replacing the existing instrument. When the secondary segment ends, the instrument is automatically unloaded, with the result that there is no instrument on that channel, and the channel plays silence.
You can turn on automatic downloading of bands for the entire performance by using the DirectMusicPerformance8.SetMasterAutoDownload method, or for an individual segment by using the DirectMusicSegment8.SetAutoDownloadEnable method.
You can manually download a band in one of the following ways:
When bands from different segments are downloaded to the same port, instruments in band can overwrite data from a previously downloaded band.
For example, suppose segment A uses a band that assigns a piano to patch number 1, and segment B uses a band that assigns a banjo to the same patch. The application calls DirectMusicSegment8.Download first for segment A and then for segment B. Even though the bands might be downloaded to different audiopaths, the instrument data is downloaded to the same synthesizer, so any note on a
This potential for patch collisions must be taken into account when the content is authored. Different segments should not use different instruments with the same patch number.
Bands take up memory, so they should be unloaded when they are no longer in use. If you have enabled automatic downloading of bands, the bands associated with a segment are unloaded automatically when the segment stops. Otherwise, you can manually unload a band by calling the DirectMusicSegment8.Unload or DirectMusicBand8.Unload method for instruments downloaded by the corresponding Download method.
The DirectMusicPerformance8.CloseDown method also unloads any remaining downloaded instruments.