[android-developers] Re: sound effect using SoundPool

2009-05-13 Thread MrChaz
Apologies for necro-posting but I thought I might as well post the fix I found for the non-looping sounds in the code TJerkW posted. Essentially setLoop() takes the Id of the instance of the sound that is being played not the Id of the loaded sound. So it should look something like this:

[android-developers] Re: sound effect using SoundPool

2009-04-04 Thread Nerdrow
I've been able to work around most of the current bugs in SoundPool while developing a step-sequencer app, but my sticking point is stopping a non-looping sound once it's started. I've seen this code suggested here and in a few other threads as a workaround for the pause/stop bug: mSoundPool.s

[android-developers] Re: sound effect using SoundPool

2009-03-12 Thread Stoyan Damov
On Sun, Feb 15, 2009 at 12:00 AM, Sundog wrote: > > I am using your class and setting it up as you indicate, but having > the same difficulty I did last time I tried to use SoundPool; I have > seven one-shot sounds that trigger from buttons and in the emulator it > works every time, but on the ph

[android-developers] Re: sound effect using SoundPool

2009-03-12 Thread TjerkW
By the way: try to use .ogg files, they are played better by android. Also i had problems with playLoop(int resid), sometimes the sample is looped, and sometimes it is not. A possible usage of the SoundEffects class is by subclassing it. The code from my example ( i am making a col game! :-

[android-developers] Re: sound effect using SoundPool

2009-03-12 Thread TjerkW
Is the API of the SoundPool the same in cupcake? I hope so. For all the people who need a reliable soundpool, i have made a class that handles the details with soundpool and is easy to use: import java.util.HashMap; import android.content.Context; import android.media.AudioManager; import andro

[android-developers] Re: sound effect using SoundPool

2009-02-14 Thread Dave Sparks
There are a lot of fixes to SoundPool coming in the Cupcake release. I need to check on the crash you mentioned - I don't recall seeing that before and it should give you an error, not crash. The range is dependent on the ratio of the sample rate of the source and the hardware output. On Feb 13,

[android-developers] Re: sound effect using SoundPool

2009-02-14 Thread Sundog
I am using your class and setting it up as you indicate, but having the same difficulty I did last time I tried to use SoundPool; I have seven one-shot sounds that trigger from buttons and in the emulator it works every time, but on the phone itself, occasionally all 7 work but usually only a rand

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread djp
Increasing the capacity of the SoundPool solved the problem. Thank you! On Feb 13, 5:34 pm, Marco Nelissen wrote: > There is a known problem (fixed in cupcake) with SoundPool that will cause > it to lock up if you try to play more simultaneous sounds than the capacity > of the SoundPool. If you

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread Robert Green
One more thing you need to know: Soundpool crashes if you change the pitch over 1.5 or under .5. I created multiple "engine" samples for higher and higher pitches, so no matter how high you hear the engine on light racer, it never goes above 1.5 playback rate. Soundpool is actually a really nic

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread Marco Nelissen
There is a known problem (fixed in cupcake) with SoundPool that will cause it to lock up if you try to play more simultaneous sounds than the capacity of the SoundPool. If you specify the capacity of the SoundPool to be higher than the largest number of sounds you will ever play at the same time, t

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread Sundog
Wow! Thanks very much! On Feb 13, 6:29 am, "tasos.klei...@gmail.com" wrote: > I have written a class that utilises MediaPlayer and SoundPool > objects. MediaPlayer is used to play looping music and SoundPool is > used for sound effects. Have a look at my > bloghttp://tkcodesharing.blogspot.co

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread tasos.klei...@gmail.com
I have written a class that utilises MediaPlayer and SoundPool objects. MediaPlayer is used to play looping music and SoundPool is used for sound effects. Have a look at my blog http://tkcodesharing.blogspot.com/2009/02/class-for-playing-music-and-sound.html --~--~-~--~~~-

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread djp
Thanks for information. I'm already using OGG files totaling about 200kB. The original uncompressed WAV files are 1.4MB. I'll try to further reduce number of files and the total size. Also, I'm not using stop/pause as it crashes the application instantly :) Robert, are you saying that your appli

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread Stoyan Damov
You need to ask Robert for the details, but I think SoundPool.play's method has an argument controlling pitch (I don't remember which if the 3rd to 5th argument that was). On Fri, Feb 13, 2009 at 11:14 AM, Markus Junginger wrote: > > > On Feb 13, 9:04 am, Stoyan Damov wrote: >> Listen to Robert

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread Markus Junginger
On Feb 13, 9:04 am, Stoyan Damov wrote: > Listen to Robert's advice, and most importantly, if you don't have a > need to manipulate the sounds during the game (e.g. Robert changes the > pitch dynamically in his game) ... How does Robert implement pitching? Is there a recommended lib? A nice sou

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread Stoyan Damov
I think I might be able to decouple the pool from my game and get rid of some entropy which sneaked in over the months, and then I don't mind posting it here. Only it's Friday 13th and I don't release on this date :P Seriously though my daughter turned 1 today, so I don't think I'll work in the ev

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread Peter Sankauskas
Has anyone been kind enough to create a sound/media pool using MediaPlayer instances and made it open source for the rest of us to use? It seems like it is a pretty common problem that many developers could take advantage of some well written and tested code. Peter On Feb 13, 12:04 am, Stoyan D

[android-developers] Re: sound effect using SoundPool

2009-02-13 Thread Stoyan Damov
Listen to Robert's advice, and most importantly, if you don't have a need to manipulate the sounds during the game (e.g. Robert changes the pitch dynamically in his game) stay away from the SoundPool. Simply build your own sound pool based on MediaPlayer instances - I know it works. It probably co

[android-developers] Re: sound effect using SoundPool

2009-02-12 Thread Robert Green
David, Please search and read about all my soundpool tests. Basically you must use OGGs totalling under 1MB and you can't call the stop or pause methods. Many of us use it but you must be careful. On Feb 12, 3:11 pm, djp wrote: > Hi, > > there seems to be a dead-lock problem when using sound