iPhone PLAYMUSIC

Previous topic - Next topic

BigAnd

I have a problem with music playback on the iPhone.

I have just added a second piece of music to my project but when the second piece of music starts, it starts at the same place the first piece of music stopped.

e.g.
Start first piece of music with PLAYMUSIC "tune01.wav",true
Wait 10 seconds
Stop first piece of music with STOPMUSIC
Start second piece of music with PLAYMUSIC "tune02.wav",true
The second piece of music starts 10 seconds into the wav.

I have tried this with mp3's also and it still does it. I have also tried adding a HUSH after the STOPMUSC just to see if that helped but with no luck.

This is not just done in a loop, its part of the game/intro loop, so SHOWSCREEN is called many times.

Hope you can help.

matchy

Generally, I have found that I need to run a "Clean" in xcode Build menu that will reload all the updated resource media files to the device.

Qube

I have just come across this exact same issue too :S

I was going to submit my game to Apple tomorrow but I can't find away around this playmusic issue. I've tried "matchy's" idea but it's exactly the same.


codegit

I have noticed the same issue but fortunately for us we only have one music track and I kinda worked around the problem.  :|
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

BigAnd

#4
The way I have got round it (for now) is that fortunately my first piece of music only has to play once, so I use a PLAYSOUND for that and then use the PLAYMUSIC in game.

The other problem I am hiving with this is that the music does not seem to repeat. So I do it manually by checking ISMUSICPLAYING in my game loop.

EDIT:
Sorry Gernot, I know you hate this music playing. I have had a look at Fmod on the iPhone but I wouldn't know how to (or if its even possible) to interface it to GLBasic. The same with Mikmod.

Qube

I've found a dirty work around for this issue  =D

Add a second of silence to the begging of your music. Create a one second silent MP3 and do the following anytime you need to play music

Quote
      STOPMUSIC
      PLAYMUSIC "blank.mp3", TRUE
      STOPMUSIC
      PLAYMUSIC "music-01.mp3", TRUE

Music will then only start somewhere in the second of silence and not effect the tunes  :good: - Not perfect, but it works for now.

BigAnd

Nice one Qube. Will give that a go  =D

Kitty Hello

Fixed in next update.

BigAnd

Ace! Awesome work!!

codegit

Quote from: Kitty Hello on 2009-Nov-09
Fixed in next update.

Thanks. It was little issues like this that never got fixed in Blitz. Gernot really listens to the developers (obviously within reason) and THAT is what makes GLBASIC great.  :nana:
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

MrTAToad

Indeed - its great to have things constantly updated.

Qube

Excellent stuff, great to see speedy updates to bugs :)

BigAnd

Just another point to note that if you are using mp3's, use a fixed bit rate, else the tune will start repeating before it ends and also the ISMUSICPLAYING will think the tune has stopped before it has done.

It would be cool to use variable bit rates with mp3's as the file size is a lot smaller but its not essential.