-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package arc.audio; | ||
|
||
import arc.files.*; | ||
import arc.util.*; | ||
|
||
/** Plays a sound from an array at random. */ | ||
public class RandomSound extends Sound{ | ||
public Sound[] sounds = {}; | ||
|
||
public RandomSound(Sound... sounds){ | ||
this.sounds = sounds; | ||
} | ||
|
||
public RandomSound(){ | ||
} | ||
|
||
@Override | ||
public void load(Fi file){} | ||
|
||
@Override | ||
public int play(float volume, float pitch, float pan, boolean loop, boolean checkFrame){ | ||
if(sounds.length > 0){ | ||
return Structs.random(sounds).play(volume, pitch, pan, loop, checkFrame); | ||
} | ||
return -1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters