Audio Effects

Punchy sound effects

The GSound is an object that can hold a sound from a Sound enum or a string, with volume and pitch information

//Default pitch and volume if not supplied
GSound sound = new GSound(Sound.CLICK); 

//Resource pack sounds
GSound resourcePackSound = new GSound("custom.sound.location", 1f, 1f);

//can play to a single player
sound.play(Player p);

//can play to a single player from a location
sound.play(Player p, Location l);

//can play to a single player from a location relative to player
sound.play(Player p, Vector v);

//can play to all nearby players
sound.play(Location l);

Stacking Audible Objects

You can take a gsound and put it next to 3 others to make something unique but play it with one object.

//Create two sounds that could go together
Audible a = new GSound(Sound.CLICK, 1f, 0.4f);
Audible b = new GSound(Sound.BAT_TAKEOFF, 1f, 1.4f);

//Create a new "Audio object"
Audible c = new Audio();

//Add our sounds from above
((Audio)c).add(a);
((Audio)c).add(b);

//Play the sound c
c.play(Bukkit.getPlayer("cyberpwn"));

Super Stacking (Usage Example)

Lets make a really bad sound

Now lets implement it

//Create Some low sounds
Audible explosion = new GSound(Sound.EXPLODE, 1f, 0.4f);        
Audible subBass = new GSound(Sound.WITHER_SPAWN, 0.6f, 0.6f);

//Create Some high sounds
Audible shatter = new GSound(Sound.GLASS, 1f, 1.6f);
Audible flap = new GSound(Sound.BAT_TAKEOFF, 1f, 1.5f);

//Make a "low audible"
Audible low = new Audio();
((Audio)low).add(explosion);
((Audio)low).add(subBass);

//Make a "high audible"
Audible high = new Audio();
((Audio)high).add(shatter);
((Audio)high).add(flap);

//Make the "global sound package"
Audible sound = new Audio();
((Audio)sound).add(high);
((Audio)sound).add(low);
((Audio)sound).add(new GSound(Sound.CLICK)); //why not?

sound.play(Bukkit.getPlayer("cyberpwn"));

results matching ""

    No results matching ""