Sorry Rings, I have a little problem with my Linux disk and I can't try this program.
You need libsmpeg library, and you can play, pause and stop music.
Please, try it and tell if it works.
Code: Select all
#NULL=0
#TRUE=1
#STOPPED=0
#PAUSED=1
#PLAYING=2
status.l=#STOPPED
song.l=0
If OpenWindow(0, 200, 200, 200, 90, #PB_Window_SystemMenu, "Rings Player")
If CreateGadgetList(WindowID(0))
ButtonGadget(0,10,40,50,30,"Play")
ButtonGadget(1,60,40,50,30,"Pause")
ButtonGadget(2,120,40,50,30,"Stop")
EndIf
EndIf
OpenLibrary(0, "/usr/lib/libsmpeg.so")
; place here your favorite MP3
song=callfunction(0, "SMPEG_new", "musica.mp3", #NULL, #TRUE)
Repeat
EventID.l = WaitWindowEvent()
GadgetID.l = EventGadgetID()
Select EventID
case #PB_Event_CloseWindow
Quit = 1
case #PB_Event_Gadget
Select GadgetID
case 0
If status<>#PLAYING
CallFunction(0, "SMPEG_play", song)
status=#PLAYING
EndIf
case 1
If status=#PLAYING
CallFunction(0, "SMPEG_pause", song)
status=#PAUSED
EndIf
case 2
CallFunction(0, "SMPEG_stop", song)
status=#STOPPED
EndSelect
EndSelect
Until Quit = 1
CallFunction(0,"SMPEG_delete",song)
CloseLibrary(0)
End