Playmusic with mp3
Blitz3D Forums/Blitz3D Programming/Playmusic with mp3
| ||
I have noticed a strange quirk. I have tested the following, and I still don't understand why. The online help doc's state that Playmusic will play .mp3 files however: PlayMusic ("My Sound.mp3") does NOT play, unlike: Music=LoadSound ("My Sound.mp3") PlaySound Music Any suggestions? (edit to add: I use Blitz v1.83) |
| ||
Channel = PlayMusic("my sound.mp3") |
| ||
The Blitz help points out that you MUST use a variable:PlayMusic (filename$) Definition Loads and begins playing a piece of music. Parameters filename$ - name of music file. Formats supported: raw/mod/s3m/xm/it/mid/rmi/wav/mp2/mp3/ogg/wma/asf Description This command will load and play a music file. You MUST use a channel variable in order to stop or adjust the music playing. You may use StopChannel, PauseChannel, ResumeChannel, etc. with this command. You can't 'preload' the audio like you can a sound sample via the LoadSound command. Every time you call the PlayMusic command, the file is reloaded and played. This means that if you use the command while some graphics are moving on-screen, you may get a slight pause when the hard drive seeks and grabs the music file. To avoid this, you might want to use the PlaySound/LoopSound commands instead. Example ; Load and play the background music chnBackground=PlayMusic("musicackground.wav") |
| ||
Variable or not doesn't matter... I encountered the same problem... Local Music = PlayMusic("Music.mp3") According to the manual you should have music with that, but not one single thing happens (To me it didn't at least).... The line in the top post didn't use a var, but that doesn't make any diffrence in this problem... If the line without var was assinged to a MIDI file, it would have worked... |
| ||
strange, i use PlayMusic("track.mp3") which works. |
| ||
Yeh, PlayMusic("blah.mp3") is just the same as 'PlayMusic "blah.mp3"' - it just discards the result - as does 'result = PlayMusic "blah.mp3"' also returns 0, but should still work. Is it happenning with any mp3 (I'm guessing yeh)... It's a very strange problem you're having... |
| ||
One thing that I notice is that Music and Sound are handled differently by Blitz. Sounds can be preloaded and then played (therefore requiring a soundchannel) Whereas music is not and cannot be preloaded. Hence there is a LoadSound AND a PlaySound command but there is only a PlayMusic command (i.e. no LoadMusic) The reason I mention this is that an MP3 file is actually much more like a Sound than a Music file (e.g. MIDI). SO, I wonder if depending on what file associations you have for your operating system - Blitz might be identifying the MP3 as a sound data file and it helpfully invokes LoadSound although you called PlayMusic. I admit this is a bit of a long shot - but maybe it'll help somebody else come up with the actual explanation and a solution. yinch'03 |
| ||
channel=PlayMusic("sound.mp3") PauseChannel channel I'm under the impression that's a good way to 'preload' a music file... I can confirm this bug, it's in B3D (havn't tested B+) v1.83. Ogg files also don't play anymore via PlaySound. Yikes. |
| ||
Has this been fixed at all? |
| ||
Has this been fixed at all? It was never broken here. |
| ||
Malice, why not upgrade b3d? it might work better in a later version... |
| ||
I will - soon as I get my PC out of storage - shouldnt be loing now... we found a house!!!!!!!!!!!!!!! I think its at 1.85, what version are we up to now? |
| ||
v1.88 |
| ||
Just a thought, could it be that control is being handed over to DirectX, which might need a more explicit path? For these functions I ususally use "\Product\Music\music.mp3" (or some such) which works fine, and suggests that the current drive remains the same without needing to restate it within the filename, but if only the current drive is known to DirectX, then it might also need a more explicit path....? |
| ||
;- |
| ||
IF I recall correctly, the demo version of Blitz3D has MP3 support disabled. Maybe that's the problem? |
| ||
Ive never used the demo version |