How to create and manage a playlist
Supported standard playlist formats are the following:
A normal playlist can be created from scratch using the PlayListCreate method.
In case you should need adding volume automation features to your playlist, you could use the PlayListCreatEx method passing PLAYLIST_AUTOMATION_MODE to the nMode parameter; further information about the use of Volume Automation can be found inside the How to manage Volume Automation tutorial.
If a playlist already exists on your PC, you can load it into a player through the PlayListLoad method; a call to this method won't return control to the container application until the playlist has been loaded completely so, if the playlist should be very long, it could block your user interface for a while; for this reason there is the possibility to call the PlayListLoadSync method which will perform playlist analysis and loading in a separate thread: the container application is informed about the loading advancement through the PlayListLoadStart, PlayListLoadPerc and PlayListLoadDone events.
A playlist can also be created directly from a CD using the PlayListLoadFromCd method that will automatically load all the available CD audio tracks.
At runtime, when an item of the playlist is loaded into the player, the PlaylistSoundLoaded event is generated. If the loading fails, for example because the format of the item is not supported or because the item is not available inside the system, the PlaylistSoundLoadFailure event is generated.
A playlist, loaded from disk or created from scratch, can be modified through the following methods:
PlayListAddItem to add one or more new songs to the playlist
PlayListAddItemWithTag to add a new song to the playlist with an associated tag string: this tag string will be reported by the PlaylistSoundLoaded event when the item is loaded into the player at runtime.
PlayListRemoveItem to remove a song from the playlist
PlayListMoveItem to change the position of a song
PlayListGetCount to retrieve the number of songs currently in the playlist
PlayListGetItemString to retrieve information about a chosen song
PlayListSetLoop to make the playlist loop when it has been executed completely
PlayListSetShuffle to set a random playing order of the playlist songs
Once the playlist has been filled you can save it on your PC using the PlayListSave method.
When the playlist has been loaded with volume automation enabled, the following methods can be used to modify contained items:
PlayListItemVolAutomPointAdd to add a new volume automation point to an existing item
PlayListItemVolAutomSetMixPos to modify mixing positions of an existing item
PlayListItemVolAutomPointRemove to remove a volume automation point from an existing item
PlayListItemCuePointAdd to add a new cue point to an existing item
PlayListItemCuePointRemove to remove a cue point from an existing item
The playlist can be executed using the following methods:
PlayListExecute to start the playlist execution from the beginning
PlayListExecNext to execute the next song
PlayListExecPrev to execute the previous song
PlayListExecAt to execute the song at the given position
PlayListStop to stop the automatic execution of the playlist
Playlists can also be used, through the embedded Automatic Fader, for cross-fading between two players: for details about using the Automatic Fader refer to the How to use the Automatic Fader section.
A playlist file can consist of both audio tracks and/or video clips: based upon the file extension, the control will decide if the file to be loaded is an audio track or a video clip; for formats like MP4 and WMV, which can be supported in both ways but which are considered as video clips by default, you can use the AudioExtensionAdd method in order to load them as simple audio tracks and to ignore the contained video stream.
Samples of use of playlists in Visual C#.NET and Visual Basic.NET can be found inside the following samples installed with the product's setup package: