Playing MP3 music files
Playing MP3 music files
I sometimes want to play a music file (often speech) while a program is running. I have usually used .wav files which is simple enough using a thread or to play once, using a separate program started with run program. However to cut down on file size and speed the loading I would like to use MP3 files as I already have them. The question is can PB play these without using the Mci() command to pass strings, this works but I don't like doing it this way. I can use Ogg Varbis, which is as easy as .wav (using UseOGGSoundDecoder()) but this means making another file just for this as I don't think I have anything else that can play .Ogg files.
Mike.
(I'm never going to catch up with the improvements to this program)
(I'm never going to catch up with the improvements to this program)
There is a good reason why I don't like doing it using Mci(), I have copied the relevant bits from a player by Dominique Bodin and it works, but I don't have a clue as to what is happening and can't find any reference to it anywhere else.
On the other hand quite a lot of my programs have bits that work without my knowing how!

On the other hand quite a lot of my programs have bits that work without my knowing how!

Mike.
(I'm never going to catch up with the improvements to this program)
(I'm never going to catch up with the improvements to this program)
- utopiomania
- Addict
- Posts: 1655
- Joined: Tue May 10, 2005 10:00 pm
- Location: Norway
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
http://msdn.microsoft.com/library/defau ... 2_open.asp
Look here for all the information you'll need on MCI strings!
And this page is also very good:
http://www.geocities.com/smigman.geo/mci/mci.html
I'm making a MCI media player, it's fun!
Look here for all the information you'll need on MCI strings!
And this page is also very good:
http://www.geocities.com/smigman.geo/mci/mci.html
Code: Select all
If mciSendString_("OPEN "+#DQUOTE$+File+#DQUOTE$+" ALIAS Media",0,0,0)=0
mciSendString_("PLAY Media",0,0,0)
Delay(5000)
mciSendString_("STOP Media",0,0,0)
mciSendString_("CLOSE Media",0,0,0)
Else
;error
EndIf
MikeB,
Don't know if this may be of any use for you, but I made a little Mp3 lib up a while ago based around simple use of Mcistrings. I havent looked at updating it for V4 yet though.
If you don't want to use it as a user lib with PB, I have included the source in the download which you may find usefull to help teach yourself how Mci works.
Lib, helpfile and source can be downloaded from here for PB 3.94 - http://www.purearea.net/pb/download/userlibs/DeMp3.zip
Don't know if this may be of any use for you, but I made a little Mp3 lib up a while ago based around simple use of Mcistrings. I havent looked at updating it for V4 yet though.
If you don't want to use it as a user lib with PB, I have included the source in the download which you may find usefull to help teach yourself how Mci works.
Lib, helpfile and source can be downloaded from here for PB 3.94 - http://www.purearea.net/pb/download/userlibs/DeMp3.zip
Thanks Baldrick, actually your userlib is one of the things I had downloaded in my initial search for a method of playing MP3s. I tried it (using PB V4) and got a string of linker errors. I saw that it was for PB 3.94 and assumed that was the reason and went on to try alternative methods. To convert for V4 seems to me to be just a matter of changing the variables to pointers for the PeekS() commands but I have never tried making a library so apart from not knowing how to do it, I might well be talking piffle. I must have a look at how to make a library when I have time, so far I have seen in the PB help file about making .dll files, but that is not the same and as far as I can see makes the calls more complicated instead of easier. 

Mike.
(I'm never going to catch up with the improvements to this program)
(I'm never going to catch up with the improvements to this program)
Yes,
The pointers are pretty much all there is, I have not bothered at this stage as I decided better to wait until V4 is stable before I put Tailbite back in, etc.
All I need is a little motivation & I will probably update it soon.
Meanwhile, the source with the lib might be helpfull to you as copy , paste & modify directly into your code.
The pointers are pretty much all there is, I have not bothered at this stage as I decided better to wait until V4 is stable before I put Tailbite back in, etc.
All I need is a little motivation & I will probably update it soon.
Meanwhile, the source with the lib might be helpfull to you as copy , paste & modify directly into your code.
-
- Enthusiast
- Posts: 103
- Joined: Fri Apr 25, 2003 4:00 pm
- Location: France
Hi MikeB
I've read your post.
Do you mean you don't have the code for my player ?
If anyone needs it i can send it for free . . .
Just ask with your e-mail adress cause i've no way to post it anywhere else.
Dominique
Do you mean you don't have the code for my player ?
If anyone needs it i can send it for free . . .
Just ask with your e-mail adress cause i've no way to post it anywhere else.
Dominique
Dominique
Windows 10 64bits. Pure basic 32bits
Windows 10 64bits. Pure basic 32bits
DominiqueB, I downloaded your player and it works fine as a player, but what I have done as well as keeping it in the original form as a player, is to take just the bits I needed to play one particular MP3 file in the background of another program. For the purpose I only need to load the file, play it and detect when it is finished so I didn't need the whole thing.


Mike.
(I'm never going to catch up with the improvements to this program)
(I'm never going to catch up with the improvements to this program)