Microsoft DirectX 8.1 (Visual Basic)

Loading Audio Data

Many DirectMusic objects have to be loaded from a file or resource before they can be incorporated into a performance. The DirectMusicLoader8 class is used to manage the loading of such objects.

In most cases, an application should have only one DirectMusicLoader8 object in existence at a time. You should create a single global loader object and not free it until there is no more loading to be done. This strategy ensures that objects are found and loaded efficiently.

However, if your application loads a segment more than once, you should be aware that because of the caching system used internally by DirectMusic, on subsequent loads you might get back the same segment object you were using before, and it will still have any settings you previously gave it, such as start and loop points or a connection to a DLS collection. To ensure that this does not happen, you should release the DirectMusicLoader8 object by setting it to Nothing, and then create a new one, before reloading the segment.

Loading of objects referenced by other objects is handled transparently. For example, suppose a style being loaded from a DirectMusic Producer file contains a reference to a band whose data is in another file. DirectMusic loads the band automatically, and the application retrieves it by using the DirectMusicStyle8.GetBand method.

More information on using the loader is contained in the following topics: