Thread: Sounds & Music

Page 18 of 18 FirstFirst ... 8161718
Results 171 to 180 of 180
  1. #171  




    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    25
    Posts
    16,056
    Thanks given
    7,048
    Thanks received
    11,835
    Rep Power
    5000
    Quote Originally Posted by Excavation View Post
    Because it would have been a good idea to have it documented to begin with?
    you didn't answer my question as to why that isn't a viable option. why on earth would everybody document what java version things are written for when java places heavy investment on backwards and forwards compatibility?

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #172  
    Extreme Donator

    Join Date
    Feb 2014
    Posts
    289
    Thanks given
    22
    Thanks received
    17
    Rep Power
    24
    Quote Originally Posted by Scu11 View Post
    paste the error into google and you'll find out
    Not really.
    Reply With Quote  
     

  3. #173  




    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    25
    Posts
    16,056
    Thanks given
    7,048
    Thanks received
    11,835
    Rep Power
    5000
    Quote Originally Posted by Excavation View Post
    Not really.
    yes really. tell me what it was and i gaurantee it's the first result

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #174  
    Extreme Donator

    Join Date
    Feb 2014
    Posts
    289
    Thanks given
    22
    Thanks received
    17
    Rep Power
    24
    Quote Originally Posted by Scu11 View Post
    you didn't answer my question as to why that isn't a viable option. why on earth would everybody document what java version things are written for when java is forwards compatible?
    I didn't know that.
    I assumed some things became obsolete, and thus in some cases the previous generally speaking are reused/used in a incompatible way.
    I did not know this case was different for Java.

    Quote Originally Posted by Scu11 View Post
    yes really. tell me what it was and i gaurantee it's the first result
    I'm a complete fucking idiot.

    I forgot I commented it, because I was so sick of trying to get this shit to work, updated the JDK version all the way up from 1.6.0_07 to 13, and thought because it didn't display an error that it fixed the problem.

    brb gonna fucking kill myself


    Oh, and for the error which I some how after all of this forgot to post is:
    error: cannot find symbol
    symbol: class SoundPlayer
    location: class client

    Pretty sure it's pointing to this line of code I tried putting in:
    Code:
    new SoundPlayer ((InputStream) new ByteArrayInputStream (stream.buffer, 0, stream.currentOffset), anIntArray1207[i], anIntArray1250[i]);
    I'm considering buying services after this. This is a complete fucking train wreck.
    Reply With Quote  
     

  5. #175  




    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    25
    Posts
    16,056
    Thanks given
    7,048
    Thanks received
    11,835
    Rep Power
    5000
    Quote Originally Posted by Excavation View Post
    error: cannot find symbol
    symbol: class SoundPlayer
    location: class client
    Quote Originally Posted by Galkon View Post
    First you need to add this class to your client (again thanks bluurr for your contributions):

    Spoiler for SoundPlayer.java:
    Code:
    package src;
    
    import java.io.InputStream;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.Clip;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.FloatControl;
    
    public class SoundPlayer implements Runnable {
    
    	private AudioInputStream stream;
    	private DataLine.Info info;
    	private Clip sound;
    
    	private InputStream soundStream;
    	private Thread player;
    	private int delay;
    	private int soundLevel;
    	public static int volume;
    
    	/**
    	 * Initializes the sound player.
    	 * @param stream
    	 * @param level
    	 * @param delay
    	 */
    	public SoundPlayer(InputStream stream, int level, int delay) {
    		if (level == 0 || volume == 4 || level - volume <= 0) {
    			return;
    		}
    		this.soundStream = stream;
    		this.soundLevel = level;
    		this.delay = delay;
    		player = new Thread(this);
    		player.start();
    	}
    
    	/**
    	 * Plays the sound.
    	 */
    	@Override
    	public void run() {
    		try {
    			stream = AudioSystem.getAudioInputStream(soundStream);
    			info = new DataLine.Info(Clip.class, stream.getFormat());
    			sound = (Clip) AudioSystem.getLine(info);
    			sound.open(stream);
    			FloatControl volume = (FloatControl) sound.getControl(FloatControl.Type.MASTER_GAIN);
    			volume.setValue(getDecibels(soundLevel - getVolume()));
    			if (delay > 0) {
    				Thread.sleep(delay);
    			}
    			sound.start();
    			while (sound.isActive()) {
    				Thread.sleep(250);
    			}
    			Thread.sleep(10000);
    			sound.close();
    			stream.close();
    			player.interrupt();
    		} catch (Exception e) {
    			player.interrupt();
    			e.printStackTrace();
    		}
    	}
    
    	/**
    	 * Sets the client's volume level.
    	 * @param level
    	 */
    	public static void setVolume(int level) {
    		volume = level;
    	}
    
    	/**
    	 * Returns the client's volume level.
    	 */
    	public static int getVolume() {
    		return volume;
    	}
    
    	/**
    	 * Returns the decibels for a given volume level.
    	 * @param level
    	 * @return
    	 */
    	public float getDecibels(int level) {
    		switch (level) {
    			case 1:
    				return (float) -80.0;
    			case 2:
    				return (float) -70.0;
    			case 3:
    				return (float) -60.0;
    			case 4:
    				return (float) -50.0;
    			case 5:
    				return (float) -40.0;
    			case 6:
    				return (float) -30.0;
    			case 7:
    				return (float) -20.0;
    			case 8:
    				return (float) -10.0;
    			case 9:
    				return (float) -0.0;
    			case 10:
    				return (float) 6.0;
    			default:
    				return (float) 0.0;
    		}
    	}
    }


    After you've added that, this is where comparing your methods with mine comes in. Find your method90 in client.java, and either replace it or compare it and change yours to fit mine:
    mts.

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. #176  
    Extreme Donator

    Join Date
    Feb 2014
    Posts
    289
    Thanks given
    22
    Thanks received
    17
    Rep Power
    24
    Quote Originally Posted by Scu11 View Post
    mts.
    Yeah, I made a dedicated file for it.
    Unless they meant something like a dedicated nested class in the client file?

    That's what I assume by what they meant by client.
    Client, like as in client as a whole, not the client.java self individually.
    Reply With Quote  
     

  7. #177  
    Administrator

    Kevy's Avatar
    Join Date
    Jul 2006
    Posts
    1,138
    Thanks given
    81
    Thanks received
    1,546
    Discord
    Kevy#1197
    Rep Power
    4658
    You are probably missing an import then or the client is packaged and the package for class SoundPlayer is wrong.

    Quote Originally Posted by Excavation View Post
    Yeah, I made a dedicated file for it.
    Unless they meant something like a dedicated nested class in the client file?

    That's what I assume by what they meant by client.
    Client, like as in client as a whole, not the client.java self individually.
    Thanks, Kevin.
    Reply With Quote  
     

  8. #178  
    Extreme Donator

    Join Date
    Feb 2014
    Posts
    289
    Thanks given
    22
    Thanks received
    17
    Rep Power
    24
    Is "currentSound" a naming difference between "anInt1062"?
    Reply With Quote  
     

  9. #179  
    Owner of Ghreborn

    Sgsrocks's Avatar
    Join Date
    Mar 2014
    Posts
    823
    Thanks given
    34
    Thanks received
    88
    Rep Power
    84
    i got this to work for my GodzHell reboot. its non renamed. LOL

    Code:
       public final void method90(boolean flag) {
            if (flag)
                anInt1008 = -1;
            for (int i = 0; i < currentSound; i++) {
                if (soundDelay[i] <= 0) {
                    boolean flag1 = false;
                    try {
    //                    if (sound[i] == anInt874 && soundType[i] == anInt1289) {
    //                        if (!method27(11456))
    //                            flag1 = true;
    //                    } else {
                            Class30_Sub2_Sub2 class30_sub2_sub2 = Class16.method241(soundType[i], sound[i], false);
                            new SoundPlayer((InputStream) new ByteArrayInputStream(class30_sub2_sub2.aByteArray1405, 0, class30_sub2_sub2.anInt1406), soundVolume[i], soundType[i]);
                            if (System.currentTimeMillis() + (long) (class30_sub2_sub2.anInt1406 / 22) > aLong1172 + (long) (anInt1257 / 22)) {
                                anInt1257 = class30_sub2_sub2.anInt1406;
                                aLong1172 = System.currentTimeMillis();
    //                            if (method59(class30_sub2_sub2.aByteArray1405, (byte) 116, class30_sub2_sub2.anInt1406)) {
    //                                anInt874 = sound[i];
    //                                anInt1289 = soundType[i];
    //                            } else {
    //                                flag1 = true;
    //                            }
                            }
                       // }
                    } catch (Exception exception) {
                    }
                    if (!flag1 || soundDelay[i] == -5) {
                        currentSound--;
                        for (int j = i; j < currentSound; j++) {
                            sound[j] = sound[j + 1];
                            soundType[j] = soundType[j + 1];
                            soundDelay[j] = soundDelay[j + 1];
                            soundVolume[j] = soundVolume[j + 1];
                        }
    
                        i--;
                    } else {
                        soundDelay[i] = -5;
                    }
                } else {
                    soundDelay[i]--;
                }
            }
    
            if (previousSong > 0) {
                previousSong -= 20;
                if (previousSong < 0)
                    previousSong = 0;
                if (previousSong == 0 && musicEnabled && !lowMemory) {
                    nextSong = currentSong;
                    songChanging = true;
                    onDemandFetcher.method558(2, nextSong);
                }
            }
        }
    maybe that will helo you

    Discord: Sgsrocks#5004
    Reply With Quote  
     

  10. #180  
    Extreme Donator

    Join Date
    Feb 2014
    Posts
    289
    Thanks given
    22
    Thanks received
    17
    Rep Power
    24
    I gave it a shot again and corrected one of my mistakes

    from this:
    Code:
    Stream stream = Sounds.method241(anIntArray1241[i], anIntArray1207[i]);
    to this:
    Code:
    ByteVector stream = Sounds.method241(anIntArray1241[i], anIntArray1207[i]);
    But it will still give errors. So unless "ByteVector" needs an import of some kind or something?

    edit- I think importing Java.io.*; should have taken care of this. (obviously it hasn't, but still)
    Reply With Quote  
     

Page 18 of 18 FirstFirst ... 8161718

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 7
    Last Post: 03-14-2012, 02:54 PM
  2. Sounds and Music
    By Dennis in forum Help
    Replies: 2
    Last Post: 06-01-2010, 01:31 AM
  3. Music and Sounds
    By Viii in forum Tutorials
    Replies: 43
    Last Post: 07-05-2009, 01:12 PM
  4. Sounds, music and more.
    By Inside Sin in forum Requests
    Replies: 0
    Last Post: 10-05-2008, 06:40 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •