android
  #1  
Old 01-02-2011, 06:43 PM
WooDChecker's Avatar
WooDChecker WooDChecker is offline
Junior Member
 
Join Date: Dec 2010
Location: Germany
Posts: 35
Default Loop a sound file and close after exit app?

Hey again!

Well.. there is still a problem with some apps I want to complete.
How do I loop a .wav file?
And when I put background music in the code, it stops instantly after I play a different sound.
Or I press the Home button and the music is still playing.
>.<Ž

How do I solve these problems?
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 01-03-2011, 01:26 PM
Brett_val's Avatar
Brett_val Brett_val is offline
Senior Member
 
Join Date: Jan 2010
Location: The Netherlands
Posts: 636
Default

Sadly we can only play one sound at a time, and the wave that is playing will stop once you start another one.

If you want the sound to stop when you exit the app, I thought closing the files would stop it. (you should close all files anyway when the app quits)

As for looping, I'm afraid you'd have to do that manually; check the passed time against wav.time(wavefile) and when it's done start it again. It's proven to work quite seamless like it does in Wavecrave.
__________________
this is a link to my personal homepage which I haven't
Reply With Quote

  #3  
Old 01-03-2011, 05:31 PM
WooDChecker's Avatar
WooDChecker WooDChecker is offline
Junior Member
 
Join Date: Dec 2010
Location: Germany
Posts: 35
Default

Thanks for the explanation : )
Damn.. I thought it is possible.

At the end of my code I close all files but the music is still playing when the app is quit. That is the only thing that hold my project in a alpha phase.
Reply With Quote

  #4  
Old 01-03-2011, 05:38 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

Quote:
Originally Posted by WooDChecker View Post
Thanks for the explanation : )
Damn.. I thought it is possible.

At the end of my code I close all files but the music is still playing when the app is quit. That is the only thing that hold my project in a alpha phase.
Manually stop the sound which is playing on exit?
Code:
wavename.stop()
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #5  
Old 01-03-2011, 06:51 PM
WooDChecker's Avatar
WooDChecker WooDChecker is offline
Junior Member
 
Join Date: Dec 2010
Location: Germany
Posts: 35
Default

No it wonŽt work.
IŽd set the music as a variable.
Code:
music = wav.load("sounds/gameseq2.wav")
And at the end of the code I close it.
Code:
music.stop()
Am I blind
Reply With Quote

  #6  
Old 01-04-2011, 03:30 PM
jbob182's Avatar
jbob182 jbob182 is offline
X-Fi2 Development Moderator
 
Join Date: Feb 2010
Location: The U.S.A.
Posts: 554
Default

There is no such function as
music.stop()
So that would be why it doesnt work. If you want to stop a wav file ( i thought closing it would do the trick but i guess not) then create a wav file with nothing in it, ( i will include one) and play it when you want to stop music.

Also you say you have music? you better make sure the file is under 6mb or so because the player does not have 10mb , and even if you close all of your resources space taken up in ram is still growing bigger, so keep the wav file small, or use somthing similiar to WaveCrave ( or WaveCrave itself then you dont have to worry about a blank wav file)
Attached Files
File Type: zip blank.zip (160 Bytes, 4 views)
Reply With Quote

  #7  
Old 01-04-2011, 06:30 PM
WooDChecker's Avatar
WooDChecker WooDChecker is offline
Junior Member
 
Join Date: Dec 2010
Location: Germany
Posts: 35
Default

Thank you jbob182, that is a good idea.
Now IŽll can complete my app and upload it here. Hope youŽll enjoy it.

Problem solved.
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 02:56 PM.