Author Topic: iPhone PLAYMUSIC  (Read 5322 times)

Offline BigAnd

  • Mc. Print
  • *
  • Posts: 44
    • View Profile
iPhone PLAYMUSIC
« on: 2009-Nov-01 »
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.

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1545
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #1 on: 2009-Nov-01 »
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.

Offline Qube

  • Mr. Polyvector
  • ***
  • Posts: 157
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #2 on: 2009-Nov-07 »
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.


Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #3 on: 2009-Nov-08 »
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

Offline BigAnd

  • Mc. Print
  • *
  • Posts: 44
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #4 on: 2009-Nov-08 »
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.
« Last Edit: 2009-Nov-08 by BigAnd »

Offline Qube

  • Mr. Polyvector
  • ***
  • Posts: 157
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #5 on: 2009-Nov-08 »
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.

Offline BigAnd

  • Mc. Print
  • *
  • Posts: 44
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #6 on: 2009-Nov-09 »
Nice one Qube. Will give that a go  =D

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: iPhone PLAYMUSIC
« Reply #7 on: 2009-Nov-09 »
Fixed in next update.

Offline BigAnd

  • Mc. Print
  • *
  • Posts: 44
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #8 on: 2009-Nov-09 »
Ace! Awesome work!!

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #9 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

  • Guest
Re: iPhone PLAYMUSIC
« Reply #10 on: 2009-Nov-09 »
Indeed - its great to have things constantly updated.

Offline Qube

  • Mr. Polyvector
  • ***
  • Posts: 157
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #11 on: 2009-Nov-10 »
Excellent stuff, great to see speedy updates to bugs :)

Offline BigAnd

  • Mc. Print
  • *
  • Posts: 44
    • View Profile
Re: iPhone PLAYMUSIC
« Reply #12 on: 2009-Nov-11 »
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.