This is my first work with dialogs, so it may be a little sketchy;
I used The Freeze MP3 player as a base, and have added on bits and pieces;
Original code found here http://www.hawkee.com/snippet/3255/
It currently only supports playing a single file, and only states the file name and time, but I'm working on it, sorry. =/ I'll update it as often as possible, hopefully it'll get much better. I'm working on figuring out how to add a whole directory, continuous play, etc. Any helpful suggestions would be much appreciated.
menu * {
.Torment { Player }
}
alias Player {
/dialog -m player player
}
dialog Player {
title " [<-TormentMP3->]"
size -1 -1 100 130
option dbu
button "Stop", 2, 55 27 32 11, flat multi
box " Music ", 3, 3 1 93 100
button "Single", 4, 32 49 37 12, flat multi
edit "", 5, 12 11 74 15
button "Play", 6, 12 27 35 11, flat multi
button "Pause||Resume", 7, 27 38 45 11, flat multi
button "Say", 8, 36 61 30 11, flat multi
box " Options ",9, 3 99 93 25
check "Repeat",10, 7 107 30 11
}
on *:DIALOG:player:sclick:4: {
//set %file $sfile(%musicdir $+ *.mp3;*.wma*.wav*.wmv*.mpeg,Select music file)
did -r $dname 5
did -a $dname 5 $regsubex($nopath(%file),/\.[^.]+$/,)
}
on *:DIALOG:player:sclick:6: {
if (%file == $null) { echo -a Sorry $nick $+ , but no file is set to play... }
else {
/splay %file
set %duration $Replace($Duration($Calc($Sound(%file).length / 1000)),mins, :,$+ secs,$+ ||)
set %play activated
}
}
on *:DIALOG:player:sclick:2: {
if (%play == $null) {
echo -a There is no song playing, therefore there is no song to stop...
halt
}
else { /splay stop | /unset %play }
}
on *:DIALOG:player:sclick:7: {
if (%pause == $null) && (%play == activated) {
splay pause
set %pause activated
halt
}
elseif (%pause == activated) {
splay resume
unset %pause
}
elseif (%play == $null) { echo -a There is no song playing, therefore there is no song to pause... }
}
on *:DIALOG:player:sclick:8: {
if (%play == $null) { echo -a $nick $+ , there is no song playing... }
else { describe $active is currently listening to: $regsubex($nopath(%file),/\.[^.]+$/,) $+ || $+ %duration | halt }
}
on *:DIALOG:player:sclick:10: {
if (%repeat == $null) { set %repeat activated }
else { unset %repeat }
}
on *:MP3END: {
if (%repeat == activated) { splay %file }
else { halt }
}
on *:DIALOG:player:close:0: { /unset %file | /unset %duration | /unset %play | /splay stop | echo -a Torment Player Closed. }