How to play MP3 under Linux ?

Linux specific forum
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

How to play MP3 under Linux ?

Post by Rings »

anyone knows a way to play MP3' with purebasic under a linux-system ?
I don't need all functions that for example FMOD offers,only a subset to play/pause is needed (and when the mp3 stops playing ) .
under Windows you can play MP3 with the Movie-Lib or over the SendMessage/Winmm.dll way.
anyone know how to do such under linux ?
please no hints only, Code or solution-links are required :)
SPAMINATOR NR.1
Saboteur
Enthusiast
Enthusiast
Posts: 273
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Post by Saboteur »

Two questions...
A front-end to mpg123 could help you? You really want a pause key?
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

yes, a Pause Key is a must.
i can live wit a 'remote-tool' but i'm sure that there must exists a sdl or similar on the linux platform.
SPAMINATOR NR.1
Saboteur
Enthusiast
Enthusiast
Posts: 273
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Post by Saboteur »

Yes! I remember now. With smpeg library you can play any video or sound. I did a little video player in C++, and you can do play, pause, stop, etc, but I think it's not difficult translate to purebasic.
I'm at work now, but I'll try to find it later, at home.
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
Saboteur
Enthusiast
Enthusiast
Posts: 273
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Post by Saboteur »

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
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

Danilo post me that it worked very well under SUSE 9.1 now.
So next is time to port my mp3-player....
thx very much
SPAMINATOR NR.1
Saboteur
Enthusiast
Enthusiast
Posts: 273
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Post by Saboteur »

:D Ok.
First... Rings MP3 player
Next... Rings video player
;) :lol:
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

Saboteur wrote::D Ok.
First... Rings MP3 player
Next... Rings video player
;) :lol:
no ->Frederic can port his MOVIE-Lib ;)
SPAMINATOR NR.1
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

does this library support video ?
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

I was able to get my MP3 to play on Mandrake 9.2 using version 3.91 of PB and by tweaking the library to: /usr/lib/libsmpeg-0.4.so.0 :D Very cool!

How would I go about finding more functions from this library?
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

I searched google for the lib and found this:
SMPEG (SDL MPEG Player Library) is a free MPEG1 video player library with sound support. Video playback is based on the ubiquitous Berkeley MPEG player, mpeg_play v2.2. Audio is played through a slightly modified mpegsound library, part of splay v0.8.2. SMPEG supports MPEG audio (MP3), MPEG-1 video, and MPEG system streams.
so fred, it seems that it can play movies and beach, the site i found this info on is http://packages.debian.org/testing/libd ... bsmpeg-dev

But notice i havent tested it, just found info on the net
Saboteur
Enthusiast
Enthusiast
Posts: 273
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Post by Saboteur »

This library uses SDL and is possible play videos with sound. I did a little player in C++ and is very easy, showing video in a SDL surface.
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
pbprog
User
User
Posts: 11
Joined: Mon Apr 06, 2009 11:00 am

Post by pbprog »

help call all command in purebasic :(

This original and smpeg
http://svn.icculus.org/smpeg/trunk/play ... iew=markup


dll like this one with the same commands!
http://docs.taoframework.com/Tao.Sdl/Ta ... _Info.html


smpeg.h for help call command!

http://www.koders.com/c/fid1BF7CB7C2C1B ... E7A3A.aspx



I call these commands as well as play stop and pause

I would take the total time, current time and other controls!

how do I get them in purebasic?
Post Reply