/** * * This class will deal with all the Crowd related objects * by scheduling these according to the state of play. * * @author Adrien Martel * @version 1 * * */ public class CrowdManager{ //we need to keep hold of this object in case we need to destroy it private CrowdAudioPlayer restingCrowd; //restingChants, filenames of the 'resting' crowd sounds private static final String[] restingChants = {"000050.WAV", "000051.WAV", "000053.WAV", "000054.WAV", "000055.WAV", "000057.WAV", "000059.WAV", "000060.WAV", "000062.WAV", "000064.WAV"}; //filesnames of the goal sounds private static final String[] goalCrowds = {"000024.wav","000025.wav","000026.wav"}; //filenames of the misses crowds private static final String[] missesCrowds = {"000021.wav","000022.wav","000023.wav"}; //filenames for the booing crowd private static final String[] booingCrowds = {"boos.wav"}; //filename for referees whistle private static final String[] whistle = { "whistle.wav" }; //filename for end of match whistle private static final String[] endOfMatch = { "EndMatchWhistle.wav" }; /** * CrowdManager constructor. Creates a new object and runs the default * crowd sounds to be outputted throughout the match. */ public CrowdManager() { restingCrowd = new CrowdAudioPlayer(restingChants, true); restingCrowd.start(); } /** * * Goal Method. Called when a goal is scored. Passes to the CrowdAudioPlayer * the array of goal filenames containing goal crowd sound file. * */ public void goal() { new CrowdAudioPlayer(goalCrowds, false).start(); } /** * * MissedOpportunity Method. Called when a shot is wide or on the post. Passes to the CrowdAudioPlayer * the array of goal filenames containing missed opportunity crowd sound file. * */ public void missedOpportunity() { new CrowdAudioPlayer(missesCrowds, false).start(); } /** * * Method foul. Called when the state of play is stopped because of the referee. * Passes the booing crowds array to the CrowdAudioPlayer. * */ public void foul() { new CrowdAudioPlayer(booingCrowds, false).start(); } /** * * Method whistle. Called when the referees whistle is blown during a match. * Passes the whistle array to the CrowdAudioPlayer. * */ public void whistle() { new CrowdAudioPlayer(whistle, false).start(); } /** * * Method endOfMatch. Called when the match ends. This passes the filename array * containing a sound clip of the final whistle of the referee. * */ public void endOfMatch() { new CrowdAudioPlayer(endOfMatch, false).start(); } }