Recent

Author Topic: [SOLVED] There must be a better way of playing MP3s  (Read 10270 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: There must be a better way of playing MP3s
« Reply #15 on: October 10, 2019, 08:51:31 pm »
It will not be possible to play mp3 "out of the box". A small extension is using BASS. You need the bass.dll from https://www.un4seen.com/, free for non-commercial projects, cross-platform. I am attaching a small demo prepared for playing mp3, wav, ogg and flac files (I don't know, BASS maybe can handle more formats, I only checked the mentioned ones). Your code requires only a few lines (my Sound* routines). The sample comes with the bass.dll for 32 bit windows. Note that you must replace it by the 64-bit version if you want to compile the demo for 64 bit, otherwise the demo will abort immediately.

Okay WP, I got this working.

It seems all I need is a Pause function.
I tried SoundPause(FChannel, FileNameEdit1.FileName);
But get error "identifer not found"

Is there a page docs somewhere so I can paw over it??
I don't see one on their site.

UPDATE:
Got this to work... but stops the playback and not pause it. So, when you click play again it starts over.

Code: Pascal  [Select][+][-]
  1. BASS_ChannelPause(FChannel);

Thanks
« Last Edit: October 10, 2019, 09:12:48 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: There must be a better way of playing MP3s
« Reply #16 on: October 10, 2019, 08:54:50 pm »
Well the other option is installing the huge library, but you don't like that too.  :)

Try UOS package.
https://wiki.freepascal.org/uos

I downloaded this and only the samples without fpGUI works.
I can't get aggPas installed for fpgui, gives me errors.. plus it is really old.

But, the UOS may work if I can't get any further with BASS.

It may be big, but the WMP active X is just to buggy, Crashes all the time. I did research and WMP crash is a well known issue.
Don't want to use wmp.dll
« Last Edit: October 11, 2019, 12:27:47 am by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: There must be a better way of playing MP3s
« Reply #17 on: October 10, 2019, 09:17:09 pm »
Hi!

Pause in Bass is very simple. Just
Code: Pascal  [Select][+][-]
  1.  
  2. BASS_ChannelPause(Stream);

And start it again with

Code: Pascal  [Select][+][-]
  1. BASS_ChannelPlay(Stream, False);

All the routines are documented in the bass.chm in the package.

Winni



pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: There must be a better way of playing MP3s
« Reply #18 on: October 10, 2019, 09:57:44 pm »
Hi!

Pause in Bass is very simple. Just
Code: Pascal  [Select][+][-]
  1.  
  2. BASS_ChannelPause(Stream);

And start it again with

Code: Pascal  [Select][+][-]
  1. BASS_ChannelPlay(Stream, False);

All the routines are documented in the bass.chm in the package.

Winni


Perfect... I was close.
I had the play correct.

However, I had for my resume button play, True instead of false

This will work for now.

I did find the docs and I am in the process of converting the delphi examples to LAZ so I can see what BASS does.


THANKS
« Last Edit: October 10, 2019, 10:12:20 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: There must be a better way of playing MP3s
« Reply #19 on: October 12, 2019, 10:36:19 pm »
Well, I was able to get the BASS system working
Here is a screenshot of the app.

THANKS FOR EVERYONES HELP!!!
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

alaa123456789

  • Sr. Member
  • ****
  • Posts: 258
  • Try your Best to learn & help others
    • youtube:
Re: There must be a better way of playing MP3s
« Reply #20 on: July 03, 2020, 05:49:38 pm »
Well, I was able to get the BASS system working
Here is a screenshot of the app.

THANKS FOR EVERYONES HELP!!!

could you please share the code

thanks

alaa123456789

  • Sr. Member
  • ****
  • Posts: 258
  • Try your Best to learn & help others
    • youtube:
Re: [SOLVED] There must be a better way of playing MP3s
« Reply #21 on: July 06, 2020, 06:56:51 pm »
hey guys

you could have this advance application from this link

https://youtu.be/85kCaxS_Kig

thanks

BobDog

  • Sr. Member
  • ****
  • Posts: 394
Re: [SOLVED] There must be a better way of playing MP3s
« Reply #22 on: December 16, 2021, 02:43:16 pm »
If you use windows then a simple audio player:
Code: Pascal  [Select][+][-]
  1.  
  2.  
  3.   function mciSendString(s: pchar; p1: pchar; p2: integer; p3: integer): integer;
  4.   cdecl external 'Winmm.dll' Name 'mciSendStringA';
  5.  
  6. function playaudio(filename:ansistring):integer;
  7. var
  8. open:ansistring;
  9. begin
  10. Open := 'open  ' + filename + ' type mpegvideo alias file1';
  11. mciSendString(pchar(open), Nil, 0, 0);
  12.  exit(mciSendString('play file1', nil, 0,0));
  13. end;
  14.  
  15. begin
  16. if(playaudio('   your path to audio file ')<>0) then writeln( 'Failed to play for one reason or another');;
  17. readln;
  18. end.
  19.  
  20.  
« Last Edit: December 16, 2021, 03:00:45 pm by BobDog »

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: [SOLVED] There must be a better way of playing MP3s
« Reply #23 on: December 17, 2021, 01:30:03 pm »
@winebrenn
I can't even believe that nowadays, when you can find many different players for music and download them without problems, someone decided to try to create something of their own. You have to spend a lot of time on it...
There are simply also People, who got that Time, and prefer Working out their own Solution.
 ;)
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

 

TinyPortal © 2005-2018