Author Topic: Using SOUND and FONT files w/ Ubuntu?  (Read 5034 times)

0 Members and 1 Guest are viewing this topic.

Offline SirCrow

  • Forum Regular
  • Posts: 144
    • View Profile
Using SOUND and FONT files w/ Ubuntu?
« on: May 30, 2018, 10:17:37 pm »
I can't access [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there], so...

Please tell me how I can get my prog. to play .mp3 or other sound files under Ubuntu.
Also, can FONTs be used w/ Ubuntu/Linux?  Thanks.

Joe
I may not always finish what I've started....

FellippeHeitor

  • Guest
Re: Using SOUND and FONT files w/ Ubuntu?
« Reply #1 on: May 30, 2018, 10:58:15 pm »
Ubuntu works just fine with sound and fonts.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(500, 300, 32)
  2.  
  3. f& = _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf", 42)
  4. IF f& THEN _FONT f&
  5.  
  6. 'Music from [youtube]https://www.youtube.com/audiolibrary[/youtube]/music
  7. 'Mr. Tea by Rondo Brothers
  8. PRINT "Loading music..."
  9. m& = _SNDOPEN("Mr_Tea.mp3")
  10.  
  11.     CLS
  12.     x = RND * (_WIDTH / 3)
  13.     y = RND * _HEIGHT
  14.     COLOR _RGB32(RND * 255, RND * 255, RND * 255), _RGB32(RND * 100, RND * 100, RND * 100)
  15.     _PRINTSTRING (x, y), "Hello, Ubuntu!"
  16.     _DISPLAY
  17.     _LIMIT 5
  18.  
  19.  

The code above compiled and ran fine on my Ubuntu 16.04 virtual machine running QB64 1.2 (development build from www.qb64.org). I've attached the mp3 file I used as well as the binary that was generated. The ttf font I used is supposed to come by default with Ubuntu.

Please share the version you're using (both Ubuntu and QB64) as well as the files you had trouble loading.

Offline SirCrow

  • Forum Regular
  • Posts: 144
    • View Profile
Re: Using SOUND and FONT files w/ Ubuntu?
« Reply #2 on: May 31, 2018, 12:17:35 am »
IDE ver. is 1.2 -- but development or not, I don't remember
Ubuntu ver. is 18. ... something....how do I check it?  Did it once, forgot how.  Terminal, no doubt.  Hate that terminal.

As far as sound files, do I need to change all \ to / in the paths?
One line in my prog. looks like this:
 Snd.Name& = _SNDOPEN("SB_Sounds\J_Pop_002.mp3", "VOL")
I may not always finish what I've started....

FellippeHeitor

  • Guest
Re: Using SOUND and FONT files w/ Ubuntu?
« Reply #3 on: May 31, 2018, 12:22:22 am »
Any parameter to _SNDOPEN that's not the file name has been deprecated, so you can drop "VOL" for good (and still be able to use _SNDVOL later on).

One thing to consider in Linux is that file names are case sensitive. Either \ / should make no difference as QB64 usually caters for that on its own, but you're on a / system, so why not go with it, right?

Check that Snd.Name& contains a value > 0 and then hit _SNDPLAY Snd.Name&, you should be good.

Did you run my sample?
« Last Edit: May 31, 2018, 12:24:28 am by FellippeHeitor »

Offline SirCrow

  • Forum Regular
  • Posts: 144
    • View Profile
Re: Using SOUND and FONT files w/ Ubuntu?
« Reply #4 on: May 31, 2018, 01:01:55 am »
Thanks.  Just ran your sample and, with the  _SNDOPEN line active, I get this:

Code: QB64: [Select]
  1. libqb/os/lnx/libqb_1_2_111100000000.o: In function `snd_decode_mp3(unsigned char*, int)':
  2. libqb.cpp:(.text+0x67a77): undefined reference to `mp3_create'
  3. libqb.cpp:(.text+0x67aaf): undefined reference to `mp3_decode'
  4. collect2: error: ld returned 1 exit status
  5.  

Without that line, it runs fine.  The .mp3 is there in the same folder as the sample source, so....?
I may not always finish what I've started....

FellippeHeitor

  • Guest
Re: Using SOUND and FONT files w/ Ubuntu?
« Reply #5 on: May 31, 2018, 01:16:39 am »
Did you run my binary? (compiled on a 64bit Ubuntu - if yours is 32bit you won't be able to anyway)

Offline SirCrow

  • Forum Regular
  • Posts: 144
    • View Profile
Re: Using SOUND and FONT files w/ Ubuntu?
« Reply #6 on: May 31, 2018, 01:46:26 am »
I believe I did, and I believe it is -- but I'll look into it further.
Thanks!
I may not always finish what I've started....