Skip to content

Commit

Permalink
[fixed] Android sound not looping.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan.sweet committed Oct 30, 2011
1 parent 317a395 commit 03571f5
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,28 @@ public long loop () {

@Override
public long loop (float volume) {
long streamId = play(volume);
soundPool.setLoop((int)streamId, -1);
if (streamIds.size == 8) streamIds.pop();
int streamId = soundPool.play(soundId, volume, volume, 1, -1, 1);
streamIds.add(streamId);
return streamId;
}

@Override
public void setLooping (long soundId, boolean looping) {
soundPool.setLoop((int)soundId, looping?-1:0);
soundPool.setLoop((int)soundId, looping ? -1 : 0);
}

@Override
public void setPan (long soundId, float pan, float volume) {
float leftVolume = volume;
float rightVolume = volume;
if(pan < 0) {

if (pan < 0) {
rightVolume *= (1 - Math.abs(pan));
} else
if(pan > 0) {
} else if (pan > 0) {
leftVolume *= (1 - Math.abs(pan));
}
soundPool.setVolume((int)soundId, leftVolume, rightVolume);

soundPool.setVolume((int)soundId, leftVolume, rightVolume);
}
}

0 comments on commit 03571f5

Please sign in to comment.