An authored segment is a file or resource that contains all the data for a piece of music. It may be based on a MIDI file, or on a style and a chordmap. Unlike a simple MIDI file or resource, it can contain band changes and variations.
Note A template is an authored segment as well, but it does not represent a self-contained piece of music. For more information, see Using Templates.
You create the segment in your application by loading the segment as an object and obtaining the IDirectMusicSegment interface, as in the following example, where the segment is loaded from a DirectMusic Producer file:
/* It is assumed that pLoader is a valid pointer to
an IDirectMusicLoader interface, and that the search
directory has been properly set. */
DMUS_OBJECTDESC ObjectDescript;
IDirectMusicSegment* pSegment;
ObjectDescript.dwSize = sizeof(DMUS_OBJECTDESC);
ObjectDescript.idClass = CLSID_DirectMusicSegment;
strcpy(ObjectDescript.wszFileName, L"Dance.sgt");
ObjectDescript.dwValidData = DMOBJ_CLASS | DMOBJ_PATH ;
pLoader->GetObject(&ObjectDescript, IID_IDirectMusicSegment,
(void**) pSegment)))
You can now pass pSegment to the IDirectMusicPerformance::PlaySegment method.