|
#1
|
|||
|
|||
|
Hi all, i hope this will be of use to a few ppl. What ive done is add/doctor examples to get what i believe is a dynamic audio player. but what i really want is to be able to call funtions from the Global Events so i dont have to put all this code on each and every page. As my project has multiple pages i feel that im wasting code and therefore resouces. So if anyone can workout how to make it Global it'll be even more productive to us all.
At Preload: Code:
-- this gets the OGG files in the below folder and loads them into the listbox
atbFiles = File.Find("AutoPlay\\Audio\\music", "*.ogg", false, false, nil, nil);
TextFile.WriteFromTable("AutoPlay\\Audio\\music\\playlist.ini", atbFiles, false);
if atbFiles then
for i,v in atbFiles do
ListBox.AddItem("Music list", String.SplitPath(v).Filename, v);
end
end
audio = File.Find("AutoPlay\\Audio\\music", "*.ogg", false, false, nil, nil);
ListBox.SetVisible("Music list", false);
On show: Code:
-- this gets the selected song and loads it.
ListBox.SelectItem("Music list", 1)
tbSelected = ListBox.GetSelected("Music list")
for index, item in tbSelected do
output = item;
end
if tbSelected then
strScript = ListBox.GetItemData("Music list", tbSelected[1]);
Audio.Load(CHANNEL_BACKGROUND, strScript, true, false)
end
-- Make sure the Load action was successful
if (Application.GetLastError() == 0) then
-- Check for file description tags
tags = Audio.GetOggTags(CHANNEL_BACKGROUND);
if (tags ~= nil) then
albumtitle = tags.TITLE;
artist = tags.ARTIST;
album = tags.ALBUM;
track = tags.TRACKNUMBER;
end
end
-- Update the status text display
Paragraph.SetText("track_title", albumtitle);
Paragraph.SetText("artist", artist);
Paragraph.SetText("current_ablum", album);
Paragraph.SetText("track_number", track);
On audio: Code:
-- This is to set up the next song when the one playing finishes.
--if you want more than 4 songs, just continue the code as below.
if e_State == "Finish" then
if output == 1 then
ListBox.SelectItem("Music list", 2)
strScript = ListBox.GetItemData("Music list", 2);
elseif output == 2 then
ListBox.SelectItem("Music list", 3)
strScript = ListBox.GetItemData("Music list", 3);
elseif output == 3 then
ListBox.SelectItem("Music list", 4)
strScript = ListBox.GetItemData("Music list", 4);
elseif output == 4 then
ListBox.SelectItem("Music list", 1)
strScript = ListBox.GetItemData("Music list", 1);
end
--this just gets the selected song and loads it.
tbSelected = ListBox.GetSelected("Music list")
for index, item in tbSelected do
output = item;
end
if tbSelected then
Audio.Load(CHANNEL_BACKGROUND, strScript, true, false)
end
end
tags = Audio.GetOggTags(CHANNEL_BACKGROUND);
if (tags ~= nil) then
albumtitle = tags.TITLE;
artist = tags.ARTIST;
album = tags.ALBUM;
track = tags.TRACKNUMBER;
end
-- Update the status text display
Paragraph.SetText("track_title", albumtitle);
Paragraph.SetText("artist", artist);
Paragraph.SetText("current_ablum", album);
Paragraph.SetText("track_number", track);
On key: Code:
-- e_Key is a built in variable that gets generated by the On Key event.
-- 13 is the virtual key code value for the [Enter] key.
if e_Key == 222 then
ListBox.SetVisible("Music list", true);
else
end
i have only been using this to troubleshoot and make sure the code is doing what i want it to do when i have no visial signs to work from. On close Code:
ListBox.DeleteItem("Music list", -1);
Code:
tbSelected = ListBox.GetSelected("Music list")
for index, item in tbSelected do
output = item;
end
if tbSelected then
strScript = ListBox.GetItemData("Music list", tbSelected[1]);
Audio.Load(CHANNEL_BACKGROUND, strScript, true, false)
end
|
|
#2
|
|||
|
|||
|
ok
-- Update the status text display
Paragraph.SetText("track_title", albumtitle); Paragraph.SetText("artist", artist); Paragraph.SetText("current_ablum", album); Paragraph.SetText("track_number", track); not working Audio.GetOggTags please mp3 track? please select all track play automatic?? Last edited by spunicher; 09-04-2006 at 10:33 AM. |
|
#3
|
||||
|
||||
|
Nice example you have there. I'm using it right now.
|
|
#4
|
|||
|
|||
|
thanx josue, u've got mail
|
|
#5
|
||||
|
||||
|
Changed the code to be a little bit more dynamicly.
instead of limiting your playlist to 4 songs I made it loop continuasly so that every time a song ends it just loads the next song on the list and when it hits the last song it starts over from 1. you can also now add song will playing from the list. They are just added to the end because every time a song ends it checks the listbox to see how many items are in it. anyway here is the code, maybe someone can fin tune it. On Audio: Code:
nPlaylist = ListBox.GetCount("liPlaylist");
if e_State == "Finish" then
if output >= nPlaylist then
output = 1
ListBox.SelectItem("liPlaylist", output)
strScript = ListBox.GetItemData("liPlaylist", output);
else output = output+1
ListBox.SelectItem("liPlaylist", output)
strScript = ListBox.GetItemData("liPlaylist", output);
end
--this just gets the selected song and loads it.
tbSelected = ListBox.GetSelected("liPlaylist")
for index, item in tbSelected do
output = item;
end
if tbSelected then
Audio.Load(CHANNEL_BACKGROUND, strScript, true, false)
end
end
cheers, Jonas Last edited by Jonas DK; 12-28-2006 at 08:20 PM. Reason: forgot something |
|
#6
|
||||
|
||||
|
nice piece of coding u got there!!
but i was wondering if u could help me out for an audio player i designed. I need a slider to keep track of the audio length as it plays like all other audio players...wondering if u or anyone else can lend a hand..please!! Thanks n, keep it rockin |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Audio Stuttering with ogg and all other audio in ams | goukilord10 | AutoPlay Media Studio 6.0 | 12 | 05-26-2006 05:15 PM |
| Build failure because of errors | Ed Stanley | AutoPlay Media Studio 6.0 | 2 | 02-07-2006 04:51 PM |
| INFO: Difference between the Media Player Object and the AVI Object | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-29-2002 03:15 PM |
| HOWTO: Make a Media Player Object Go Full Screen | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-23-2002 12:23 PM |
| Menu in session2 to play audio tracks in session 1, cd player? | MartinUK | AutoPlay Menu Studio 3.0 | 1 | 03-20-2002 06:35 PM |
All times are GMT -6. The time now is 06:24 AM.








as it plays like all other audio players...
Linear Mode

