This is a tutorial about sounds and music ingame and how to use and handle them in a better way. If you accuse me of leeching then just leave.
Why did I do this?
I made this tutorial because there isn't many tutorials on sounds/music also because I want to try using enums 
Part 1: Add the 'Sound' class.
Code:
public class Sound {
//TODO : Implement more sounds...
public static enum SOUND_LIST {
/*
* Miscellaneous sounds.
*/
FOOD_EAT(317),
ITEM_DROP(376),
ITEM_COOK(357),
ITEM_PICKUP(358),
FIRE_LIGHT(375),
ARROW_SHOOT(370),
TELEPORT(202),
BONE_BURY(380),
POTION_DRINK(334),
TREE_CUT_BEGIN(471),
TREE_CUTTING(472),
TREE_EMPTY(473),
LOG_FLETCH(375),
/*
* Magic
*/
ALCHEMY_LOW(224),
ALCHEMY_HIGH(223),
BLITZ_ICE(1110),
/*
* Weapons
*/
ATTACK_WHIP(4151, 1080),
SPECIAL_WHIP(4151, 1081),
ATTACK_FLAIL(4755, 1059),
ATTACK_GMAUL(4153, 1079),
ATTACK_DDS(5698, 793),
SPECIAL_DDS(5698, 385),
SPECIAL_DLONG(1305, 390),
ATTACK_SCIMITAR(396),
ATTACK_LUNGE(398),
ATTACK_HAMMERS(4747, 1062),
ATTACK_GREATAXE_SLASH(4718, 1057),
SPECIAL_BOW(386),
SPECIAL_DBA(1377, 389),
SPECIAL_DSPEAR(1249, 388),
SPECIAL_MACE(1434, 387),
SPECIAL_MAUL(4153, 1082),
SHIELD_BLOCK(791);
int weapon, weaponSound, sound;
SOUND_LIST(int weapon, int weaponSound) {
this.weapon = weapon;
this.weaponSound = weaponSound;
}
SOUND_LIST(int sound) {
this.sound = sound;
}
public int getSound() {
return sound;
}
public int getWeaponSound(int weapon) {
if (weapon == this.weapon)
return weaponSound;
else
return sound;
}
}
}
Part 2: Add the 'Music' class.
Code:
public class Music {
public static enum CITY_MUSIC {
VARROCK(169),
WATERFALL(125);
int music;
CITY_MUSIC(int music) {
this.music = music;
}
public int getMusic() {
return music;
}
}
}
Thats just the handling of sounds/music if you want to add more then simply change the last ; to a , and then add a new sound. Sorry if thats not enough sounds for your likings.
Part 3: Playing the sounds
Go to your client class and declare the following method if it isn't declared;
Code:
public void playSound(int i1, int i2, int i3) {
outStream.createFrame(174);
outStream.writeWord(i1);
outStream.writeByte(i2);
outStream.writeWord(i3);
}
Part 4: Usage
Search for case 87: and below it add:
playSound(Sound.SOUND_LIST.ITEM_DROP.getSound(), 0, 0);
Part 5: Playing and stopping music
Code:
public void musicManager(String action, int songID) {
if (action == "PLAY") {
outStream.createFrame(74);
outStream.writeWordBigEndian(songID);
}
if (action == "STOP") {
outStream.createFrame(74);
outStream.writeWordBigEndian(-1);
}
}
Part 6: Usage
Search for case 121: and below it add:
Code:
musicManager("PLAY", Music.CITY_MUSIC.WATERFALL.getMusic());
And you are done! There should be NO errors.
Rep if I helped you