» Back To Index
Demoniak3D/LUA Api: Playlist
The
HYP_Playlist library provides several features for managing soundtracks (adding / suppressing / audio track play
in the same way as the playlists of winamp ;) ).
HYP_Playlist.Create
HYP_Playlist.Destroy
HYP_Playlist.AddTrack
HYP_Playlist.RemoveTrack
HYP_Playlist.SetCurrentTrack
HYP_Playlist.GetCurrentTrackId
HYP_Playlist.GetCurrentTrackName
HYP_Playlist.Play
HYP_Playlist.Stop
HYP_Playlist.SetOptions
Create
Create allows to create a new playlist.
Syntax
id = HYP_Playlist.Create( name );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the newly created playlist.
Destroy
Destroy allows to destroy a playlist.
Syntax
HYP_Playlist.Destroy( name|id );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
AddTrack
AddTrack allows to add an audio track to a playlist.
Syntax
id_st = HYP_Playlist.AddTrack( name|id, soundtrack_name|soundtrack_id );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
- soundtrack_name - [STR127] - name of the soudtrack. This name may also be the relative path to the audio file.
- soundtrack_id - [INTEGER] - identifier of the soudtrack. This identifier may have been changed wether in the XML code or by the HYP_Sound.Load() function.
- id_st - [INTEGER] -identifier of the newly added soudtrack.
Example
id_pl = HYP_Playlist.Create( "myCoolPlaylist" );
id_st1 = HYP_Playlist.AddTrack( id_pl, "data/mp3/first.mp3" );
id_st2 = HYP_Playlist.AddTrack( id_pl, "data/mp3/second.mp3" );
HYP_Playlist.Play( id_pl );
RemoveTrack
RemoveTrack to remove an audio track from a playlist.
Syntax
HYP_Playlist.RemoveTrack( name|id, soundtrack_name|soundtrack_id );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
- soundtrack_name - [STR127] - name of the soudtrack.
- soundtrack_id - [INTEGER] - identifier of the soudtrack.
SetCurrentTrack
SetCurrentTrack allows to change audio track for playing.
Syntax
HYP_Playlist.SetCurrentTrack( name|id, soundtrack_name|soundtrack_id );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
- soundtrack_name - [STR127] - name of the soudtrack.
- soundtrack_id - [INTEGER] - identifier of the soudtrack.
GetCurrentTrackId
GetCurrentTrackId allows to get the identifier of the current playing audio track.
Syntax
id_st = HYP_Playlist.GetCurrentTrackId( name|id );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
- id_st - [INTEGER] - identifier of the soudtrack.
GetCurrentTrackName
GetCurrentTrackName allows to get the name of the current playing audio track.
Syntax
name_st = HYP_Playlist.GetCurrentTrackName( name|id );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
- name_st - [INTEGER] - name of the soudtrack.
Play
Play allows to start playing audio track from the playlist.
Syntax
HYP_Playlist.Play( name|id );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
Stop
Stop allows to stop playing audio track from the playlist.
Syntax
HYP_Playlist.Stop( name|id );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
SetOptions
SetOptions allows to change the working mode of the playlist.
Syntax
HYP_Playlist.SetOptions( name|id, options );
- name - [STR127] - name of the playlist.
- id - [INTEGER] - identifier of the playlist.
- options - [INTEGER] - options de la playlist:
-
- PLAYLIST_TRACKS_MANAGEMENT_OFF = 1
- PLAYLIST_TRACKS_MANAGEMENT_ON = 2
- PLAYLIST_LOOP_ON = 3
- PLAYLIST_LOOP_OFF = 4
- PLAYLIST_DISPLAY_CUR_TRACK_NAME_ON = 6
- PLAYLIST_DISPLAY_CUR_TRACK_NAME_OFF = 7
- PLAYLIST_ENABLED = 8
- PLAYLIST_DISABLED = 9
These options are "problem-free" except for PLAYLIST_TRACKS_MANAGEMENT_ON/PLAYLIST_TRACKS_MANAGEMENT_OFF.
LAYLIST_TRACKS_MANAGEMENT_ON let Hyperion manage the different audio track transitions. It is the default value.
PLAYLIST_TRACKS_MANAGEMENT_OFF requires to use afterwards HYP_Sound.IsTrackFinished() and other functions
from the HYP_Sound lib to manage oneself the audio file playing.