Skip to content

Commit

Permalink
Fix sound bug (maybe)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Feb 1, 2017
1 parent 6a45790 commit 6524fe8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions core/src/io/github/lonamiwebs/klooni/game/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,9 @@ public int clearComplete() {
}

if (Klooni.soundsEnabled()) {
long id = stripClearSound.play();
pan = MathUtils.clamp(pan, -1, 1);
stripClearSound.setPitch(id, MathUtils.random(0.8f, 1.2f));
stripClearSound.setPan(id, pan, MathUtils.random(0.7f, 1f));
stripClearSound.play(
MathUtils.random(0.7f, 1f), MathUtils.random(0.8f, 1.2f), pan);
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/io/github/lonamiwebs/klooni/game/PieceHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void takeMore() {
}
if (Klooni.soundsEnabled()) {
// Random pitch so it's not always the same sound
takePiecesSound.setPitch(takePiecesSound.play(), MathUtils.random(0.8f, 1.2f));
takePiecesSound.play(1, MathUtils.random(0.8f, 1.2f), 0);
}
}

Expand Down Expand Up @@ -159,7 +159,7 @@ public int dropPiece(Board board) {
// The larger the piece size, the smaller the pitch
// Considering 10 cells to be the largest, 1.1 highest pitch, 0.7 lowest
float pitch = 1.104f - pieces[heldPiece].calculateArea() * 0.04f;
pieceDropSound.setPitch(pieceDropSound.play(), pitch);
pieceDropSound.play(1, pitch, 0);
}
pieces[heldPiece] = null;
} else {
Expand Down

0 comments on commit 6524fe8

Please sign in to comment.