Microsoft DirectX 8.1 (Visual Basic) |
By default, when you play a MIDI file the instruments used are those in the Roland GM/GS Sound Set, contained in the Gm.dls file. However, you can use instruments from any
To do so, load the collection, associate it with the segment based on the MIDI file, and download the collection as you would with any other segment.
The following example code, where dmLoader is a DirectMusicLoader8 object, loads a DLS collection, connects it to the DirectMusicSegment8 object represented by dmSeg, and downloads it to the default audiopath of the DirectMusicPerformance8 object dmPerf:
Dim dmColl As DirectMusicCollection8
Set dmColl = dmLoader.LoadCollection("boids.dls")
dmSeg.ConnectToCollection dmColl
dmSeg.Download dmPerf.GetDefaultAudioPath
When a custom collection is attached to a MIDI segment, the connection to the GM collection is not broken. For example, suppose you load a collection containing a single instrument that has a patch number of 12 and connect this to the segment. MIDI channels with any patch number other than 12 continue to be played by the appropriate instruments in the GM collection.
For more information on collections, see Using Instrument Collections.