|
You have your "internal" sound list where you can add ogg/wma/asf files or import files from external list m3l/m3u/pls/txt. Even the description 'Song List' predetermine to use Song List as a storage of audio files, you can use it as a general storage of video, picture or txt files too. Added files are stored in <List> storage.
See AudioTags.mbd sample file in Samples directory.
|
|
Description
|
|
Delete All items from song internal list <List>. It's useful in cases, when you need to replace the actual songlist with the new content.
|
|
Code Example
|
|
SongListReset()
|
|
|
|
Description
|
|
Add audio (video, image, etc.) file to the internal list <List>
|
|
Code Example
|
|
**This will add a file to the internal list <List>
background-color:#ffffe0("<SrcDir>\mysound.ogg")
**This will add a selected file from OpenFile dialog to the internal list <List>
OpenFile("MP3 Audio Files (*.mpg;*.mp1;*.mp2;*.mp3)|*.mpg;*.mp1;*.mp2;*.mp3|OggVorbis Files(*.ogg)|*.ogg|Win Media Audio Files (*.wma)|*.wma|Advanced Streaming Format Files (*.asf)|*.asf|Playlist Files (*.m3l;*.m3u;*.pls)|*.m3l;*.m3u;*.pls|All Files|*.*||","*.mp3")
If (OpenFile$ <> '') Then
SongListAdd("OpenFile$")
End
And finally this advanced example shows you how to feed SongList and ListBox with the content of a selected directory (with subdirectories) and sort them by Name
** Browse for folder
BrowseForFolder("Select a folder:","")
** Feed variable with the path to selected directory
Audiodir$=CBK_OpenDir
If (Audiodir$ <> '') Then
** Search files in selected directory and feed the SongList
SearchForFiles("Audiodir$","")
** Reset ListBox
ListBoxAddItem("ListBox","RESET")
** Feed the ListBox with SongList content
ListBoxAddItem("ListBox","<List>")
** Sort ListBox by Name
ListBoxSortItems("ListBox","NAME")
** Reset internal SongList..
SongListReset()
**..and refill it with sorted ListBox
ListBoxGetItems("ListBox","<List>")
End
|
|
|
|
Description
|
|
Delete a given item from internal list <List>.
|
|
Code Example
|
|
**This will delete first item from the internal list <List>
SongListDel("1")
**This will delete items 1 to 10 from internal list <List>
For i=1 To 10
SongListDel("i")
Next i
|
|
|
|
Description
|
|
Play the internal list of audio files <List>, you can specify from which item to start. If no item is specified, then it will start from the first item.
|
|
Code Example
|
|
**This will play internal list from 1st item.
SongListPlay("")
**This will start playback of selected file in ListBox
ListBoxGetSelectedItems("SongList","Items$,ItemsNum$,#,NumItems")
numitem$ = GetArrayItem(ItemsNum$,#,1)
SongListPlay("VAL(numitem$)")
|
|
|
|
Description
|
|
Play the next song from the internal song list <List>.
|
|
Code Example
|
|
**This will play the next song from the <List>
SongListNext()
|
|
|
|
Description
|
|
Play the previous song from the internal song list <List>.
|
|
Code Example
|
|
**This will play the previous song from the <List>
SongListPrev()
|
|
SongListLoad("Path","FileFormat")
|
|
Description
|
|
Feed the internal <List> with external list of files.
Supported file formats : *.m3l, *.m3u, *.pls, *.txt (plain txt file).
In "File Format" field you can specify format (M3L, M3U, PLS, TXT) for reading so you can read TXT file as M3L format or M3U as TXT. This is useful in some special cases (e.g. editing), because all these formats are different and sometimes you may need to read for example M3U as TXT. Also, if SongList contains links to non-audio files (like images) reading as TXT will assure that the list of files will be read as plain txt file and not list of audio files (i.e. doesn't attempt to get times from files).
Also, if you want to use TXT file as an audio list, you will have to always specify the loading in M3L format, because it uses some audio list reading improvements.
If the FileFormat is not defined, the SongListLoad will load the file in the original file format (i.e. m3u as m3u, txt as txt,...)
|
|
Code Example
|
|
**This load the m3u playlist to the internal list <List>
SongListLoad("<SrcDir>\list.m3u","m3u")
**This load the selected playlist to the internal list <List> and feed the ListBox
OpenFile("Play Lists(*.m3l;*.m3u;*.pls;*.txt)|*.m3l;*.m3u;*.pls;*.txt|All Files|*.*||","*.m3l;*.m3u;*.pls;*.txt")
If (OpenFile$ <> '') Then
SongListReset()
ListBoxAddItem("SongList","RESET")
SongListLoad("OpenFile$","")
ListBoxAddItem("SongList","<List>")
End
|
|
|
|
Description
|
|
Randomize the Internal List <List>.
|
|
Code Example
|
|
**This randomize internal list <List>
SongListRND()
**This load the selected playlist to the internal list <List>, randomize it and feed the ListBox
OpenFile("Play Lists(*.m3l;*.m3u;*.pls;*.txt)|*.m3l;*.m3u;*.pls;*.txt|All Files|*.*||","*.m3l;*.m3u;*.pls;*.txt")
If (OpenFile$ <> '') Then
**Reset previous <List> and ListBox
SongListReset()
ListBoxAddItem("SongList","RESET")
**Load new <List>
SongListLoad("OpenFile$")
**Randomize new list
SongListRND()
**Feed the ListBox
ListBoxAddItem("SongList","<List>")
End
|
|
|
|
Description
|
|
Open special window that enables user edit the virtual song list, save to disk or load it from disk. The adding new item is very easy - just drag and drop files from explorer to this edit window. From MMB4.9 you can save/load or edit the internal song lists by individual scripting commands (SongListLoad, SongListSave, SongListDel, etc.).
|
|
Code Example
|
|
**This open <List> edit dialog
SongListEdit()
|
|
SongListSave("SongList/ListBoxLabel","Path")
|
|
Description
|
|
Save internal List into file. If file or ListBoxObject is not defined, "Save As" dialog will appear. Optionally, in Object field you can define ListBox object to store its content instead of internal List.
|
|
Code Example
|
|
**This open SaveAs dialog, for selecting path and filename of SongList file and then save the internal SongList <List>.
SongListSave("","")
Use the below code if you want to save <List> or ListBox content to a file with a different extension than m3l. However, the output file will be still plain m3l file ;)
**This open SaveAs dialog, for selecting path and filename of SongList file and then save the internal SongList <List>.
SaveFile("Play Lists(*.m3l;*.m3u;*.pls;*.txt)|*.m3l;*.m3u;*.pls;*.txt|All Files|*.*||","*.m3l;*.m3u;*.pls;*.txt")
If (OpenFile$ <> '') Then
SongListSave("<List>","OpenFile$")
End
|
|
|
|
Description
|
|
Calculate total time of songs (or video) in <List> and fill the CBK_TotalList or CBK_TotalListSec. These CBK constants are not filled right after loading the files into <List> because processing of very long SongList can take very long time (especially on slower computers). Therefore we decided to do not process the TotalList calculation automatically after loading the files to SongList, but rather provide this SongListTime function.
|
|
Code Example
|
|
**Simply use this function according your needs (for example after loading SongList) and don't forget to add Text object with label CBK_TotalList or CBK_TotalListSec label.
OpenFile("Play Lists(*.m3l;*.m3u;*.pls;*.txt)|*.m3l;*.m3u;*.pls;*.txt|All Files|*.*||","*.m3l;*.m3u;*.pls;*.txt")
If (OpenFile$ <> '') Then
SongListReset()
ListBoxAddItem("SongList","RESET")
SongListLoad("OpenFile$")
ListBoxAddItem("SongList","<List>")
SongListTime()
End
|
|
|