Page 1 of 1

MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sat Feb 12, 2011 4:53 pm
by C64
Is it a PureBasic bug when an MP3 doesn't play (it's all bleeps and bloops, you know that "corrupt" sound) or is it a problem with DirectX on my PC, or what? Because I have a song that refuses to play with PureBasic and it means the media-playing component of my program is currently unreliable. :( BTW, it's only this one song that doesn't play: all my other MP3s play fine with PlayMovie(). Yes, I could probably download or rip it again, but that's not the point here. I need to be able to handle unexpected MP3 problems like this.

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sat Feb 12, 2011 5:11 pm
by TomS
There are a ton of reasons why this particular file won't work. Unless you really dig into the format of mp3 there's no way you can prevent something like this.
But it's really the same with every codec.
Some files won't work in winamp and some files only work with the media player.
Have you tried the media player yet?
My guess is that the file is corrupted and winamp recognised this and compensated for it.

But I wouldn't worry so much about it.
I guess it's for a game or something?
If it doesn't work on your pc, it probably won't work on any other system and vice versa.

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sat Feb 12, 2011 5:21 pm
by C64
Media Player also can't play it, but that's no surprise because it also uses DirectX like PureBasic. I can just imagine my users freaking out when a song starts going bezerk like that on them! Then the bug reports will come in, and I will be unable to help. What can I tell them, without looking unprofessional? :(

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sat Feb 12, 2011 5:29 pm
by TomS
If Media player can't play it, I think that kinda proofs my theory that winamp compensates for an error in the file.
You have your bug right there on your computer. It's the mp3 file. Find another file that works and I don't think any of your costumers will have any problems with it.
Try converting the file to wave and then to mp3 again with lame.

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sat Feb 12, 2011 5:36 pm
by C64
You're misunderstanding the problem. I don't provide the MP3s; the customers do. One component of my program is a media player (as I said in my first post). So, if the customers also have corrupt MP3 files, my program will highlight that fact by playing bleeps and bloops. Then they're going to contact me and say "your program has a bug, it won't play this but Winamp does". How do I respond to that? Tell them to download it again? Not professional. It basically makes that part of my program useless, so I think I have no alternative but to rip it out and not offer it. :(

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sat Feb 12, 2011 5:45 pm
by TomS
Don't use the movie lib for an mp3 player.
Use a dll like bass.dll or fmod.dll.
And yey you can tell your costumers, that they downloaded a corrupted file and that winamp only plays it because they have 10+ years experience with playing audio files and they're compensating for the obvious error in the file.
Chances are they file that's corrupt is either copied from a very damaged cd, or illegally downloaded.
And if none of these is the case then they use a program with a damaged algorythm to create the file. Then they have more than one file that's corrupt and they'll have to choose between using your programm and using the programm that corrupted the files.

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sat Feb 12, 2011 11:02 pm
by dobro
TomS wrote:Don't use the movie lib for an mp3 player.
Use a dll like bass.dll or fmod.dll.
or simply use MCI commande ;)

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sun Feb 13, 2011 3:12 am
by C64
I can successfully play most MP3s with this MCI method:

Code: Select all

mciSendString_("open "+file$+" alias MyTrack",0,0,0)
mciSendString_("play MyTrack",0,0,0)
But the problem is, the same MP3 file still plays corrupted. So the MCI method is no better than the Movie library. Looks like I'll have to either use a third-party DLL (don't really want to do that) or just put a note in the FAQ of my user manual that if songs don't play back correctly, then they're damaged and will need to be repaired or replaced by the user. I'll also get them to test the MP3 in Windows Media Player, which will also play it incorrectly, so they can see for themselves that it's not a bug in my program. That sounds like the best solution.

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sun Feb 13, 2011 3:27 am
by ts-soft
TomS wrote:Use a dll like bass.dll or fmod.dll.
Have you ever seen the price for use this in commercial programs? :mrgreen:

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sun Feb 13, 2011 8:04 pm
by charvista
@C64
You can also try running an external MP3 player from PureBasic:

Code: Select all

; PureBasic can basically play *.WAV files
; PureBasic can additionally play *.OGG files with UseOGGSoundDecoder
; PureBasic can additionally play *.FLAC files with UseFLACSoundDecoder
; PureBasic can additionally play *.MP3, *.WMA, *.M3U and *.MID through the CommandLine of yPlay.exe from 'Spacejock Software'
; yPlay.exe can also play *.WAV, *.OGG and *.FLAC files
; download from http://www.spacejock.com/yPlay.html

Win=OpenWindow(#PB_Any,0,0,800,500,"MP3 Player",#PB_Window_SystemMenu)
RunProgram("C:\!Applic\yPlay\yPlay.exe",Chr(34)+"C:\Temp\kw.mp3 --hide--exit"+Chr(34),"",#PB_Program_Hide)
CloseWindow(Win)
End
Update the paths to yours.

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sun Feb 13, 2011 8:26 pm
by inc.
http://www.purebasic.fr/english/viewtop ... 14&t=22824

It uses DirectX/Directshow, easy to handle and to integrate. Just use this one for movie and mp3 playback instead of the internal PB Movie Lib

Re: MP3 doesn't play with PlayMovie() but does in Winamp

Posted: Sun Feb 13, 2011 11:00 pm
by charvista
viewtopic.php?f=14&t=22824

It uses DirectX/Directshow, easy to handle and to integrate. Just use this one for movie and mp3 playback instead of the internal PB Movie Lib
Fascinating!