| KoyimZ | Date: Sunday, 2012-07-08, 1:35 AM | Message # 1 |
|
Private
Group: Users
Messages: 1
Status: Offline
| Well, Just realized that whoever was working on the average PI client thought it be nice to just give up on sounds and music.
First of all I know this tutorial has been released multiple times, but for deltascape. You could tell me that anyone could convert, but as i said before, the PI client has taken out necessary code i will be giving you
I have perfected Music(Fading out, leveling, frames to make it start back up on leveling) and sounds on delta(Im obsessed and renamed my own client). I'll be releasing a tutorial for music once i figure it out, seeing as more than just the signlink has been obliterated.
Purpose: To add sounds on your PI Dificulty: I don't see the point of this, everythings always copy and paste anymore :l so wtf, 10 Classes modified: Signlink and PlayerAssistant.java
Client-sided: In Signlink.java
first add these under the first {
enum Position {
LEFT, RIGHT, NORMAL }; private final int EXTERNAL_BUFFER_SIZE = 524288; // 128Kb private Position curPosition;
now search for: waveplay
There should be an if statement like so if (waveplay) {
followed by a similar one for midi.
Replace the whole if(waveplay) { part with AudioFormat format = audioInputStream.getFormat(); SourceDataLine auline = null; DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
try { auline = (SourceDataLine) AudioSystem.getLine(info); auline.open(format); /* if (auline.isControlSupported(FloatControl.Type.MASTER_GAIN)) { double[] volumes = { 0.0, 0.25, 0.5, 0.75, 1.0 }; float dB = (float)(Math.log(volumes[volumeType]) / Math.log(10.0) * 20.0); FloatControl pan = (FloatControl) auline.getControl(FloatControl.Type.MASTER_GAIN); pan.setValue(dB); }*/ } catch (LineUnavailableException e) { e.printStackTrace(); return; } catch (Exception e) { e.printStackTrace(); return; }
if (auline.isControlSupported(FloatControl.Type.PAN)) { FloatControl pan = (FloatControl) auline.getControl(FloatControl.Type.PAN); if (curPosition == Position.RIGHT) { pan.setValue(1.0f); } else if (curPosition == Position.LEFT) { pan.setValue(-1.0f); } }
auline.start(); int nBytesRead = 0; byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
try { while (nBytesRead != -1) { nBytesRead = audioInputStream.read(abData, 0, abData.length); if (nBytesRead >= 0) { auline.write(abData, 0, nBytesRead); } } } catch (IOException e) { e.printStackTrace(); return; } finally { auline.drain(); auline.close(); } }
Save and compile and you're done with the client side
Server-sided: In PlayerAssistant.java
First: search for public void resetFollow() {
make it look like the following by commenting all references calling the frame 174 public void resetFollow() { c.followId = 0; c.followId2 = 0; c.mageFollow = false; //c.outStream.createFrame(174); //c.outStream.writeWord(0); //c.outStream.writeByte(0); //c.outStream.writeWord(1); }
now add this under any of your other voids: public void sendSound(int i1, int i2, int i3) { c.outStream.createFrame(174); c.outStream.writeWord(i1); //id c.outStream.writeByte(i2); //volume, just set it to 100 unless you play around with your client after this c.outStream.writeWord(i3); //delay c.updateRequired = true; c.appearanceUpdateRequired = true; c.flushOutStream(); }
Heres a command: if (playerCommand.startsWith("sound") && c.playerName.equalsIgnoreCase("gara494")) { String[] args = playerCommand.split(" "); c.getPA().sendSound(Integer.parseInt(args[1]), 100, 0); }
Good Luck
|
| |
|
|
| Overpain | Date: Sunday, 2012-07-08, 11:59 AM | Message # 2 |
|
Owner of Overpain
Group: Administrators
Messages: 16
Status: Offline
| Ok it's interesting, but why music? I mean you could open youtube too and listen music there. In fact im thinking of an Radio station built by me with pk Music. + The file is getting huge if I add music.
But I like what you did. Making tutorials for me. Maybe I will use this and if I do I will reward you.
Cheers
|
| |
|
|
| dave | Date: Thursday, 2012-07-12, 1:06 AM | Message # 3 |
 Sergeant
Group: Users
Messages: 30
Status: Offline
| l0l u do realize that is copy and paste. gl!
win win win win win win win win win win win win win win win win win win win win win
|
| |
|
|
| Failz4Skillz | Date: Sunday, 2012-07-15, 4:08 PM | Message # 4 |
 Sergeant
Group: Users
Messages: 24
Status: Offline
| I do not like this to be honest..
|
| |
|
|
| CoderPk | Date: Monday, 2012-07-16, 1:15 PM | Message # 5 |
|
Private
Group: Users
Messages: 5
Status: Offline
| We dont really need sound, kind of a waste of space and takes ages for the coding to sometimes get right! +i hate clients with sound, i always mute them because I like listening to my music on itunes or youtube!
|
| |
|
|