Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - megatlantis

Pages: [1]
1
Other Support / Re: play mp3 song from online file
« on: October 08, 2012, 12:17:43 PM »
oh! your last script is working very well !! that really much easy that i think finnally, thanks a lot !

2
Other Support / Re: play mp3 song from online file
« on: October 08, 2012, 11:17:19 AM »
i use the mp3 plugin from  fireandfuel , he made this for paulscode , you say i need to use the feedRawAudioData()  method , can you explain me how do i have to do that please ? i have no idea how work rawdata :s , thanks

3
Other Support / Re: play mp3 song from online file
« on: October 08, 2012, 06:35:50 AM »
after some try , the nullpointer is because i badly set the SoundSystem class to my 'ss' var , but now , when i try to load my mp3 , nothing happen :


Code: [Select]
InputStream audioSrc = mc.getClass().getResourceAsStream("cimsound/"+soundname);
    AudioInputStream in;
    if(audioSrc==null){
            URL url = new URL("http://xxx.xx/"+soundname);
            in = AudioSystem.getAudioInputStream(url);
    }else{
    InputStream bufferedIn = new BufferedInputStream(audioSrc);
in = AudioSystem.getAudioInputStream(bufferedIn);

    }
        AudioInputStream din = null;
        AudioFormat baseFormat = in.getFormat();
        AudioFormat decodedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
                baseFormat.getSampleRate(),
                16,
                baseFormat.getChannels(),
                baseFormat.getChannels() * 2,
                baseFormat.getSampleRate(),
                false);
        din = AudioSystem.getAudioInputStream(decodedFormat, in);
        sndSystem.rawDataStream(decodedFormat, true, "test",x, y, z, 1, 10.0f);
        sndSystem.setPitch("test", 1);
        sndSystem.setVolume("test", 1);
        sndSystem.play("test");
        System.out.println(sndSystem.playing("test"));

(the System.out.println(sndSsystem.playing("test"); return false .

4
Other Support / play mp3 song from online file
« on: October 07, 2012, 04:31:40 PM »
hello , i'm trying to play a mp3 file from a url but i go a nullpointerexception when i set the rawdatastream .
thanks for helping me  !
this code first try to play local file located in my .jar , and if no exist it will gonna try take one from my server .
here is my code :

Code: [Select]
       
 try{
                                InputStream audioSrc =getClass().getResourceAsStream("cimsound/"+soundname);
        AudioInputStream in;
        if(audioSrc==null){
                   URL url = new URL("http://xxx.xx/"+soundname);
                     in = AudioSystem.getAudioInputStream(url);
        }else{
        InputStream bufferedIn = new BufferedInputStream(audioSrc);
in = AudioSystem.getAudioInputStream(bufferedIn);
        }
            AudioInputStream din = null;
            AudioFormat baseFormat = in.getFormat();
            AudioFormat decodedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
                    baseFormat.getSampleRate(),
                    16,
                    baseFormat.getChannels(),
                    baseFormat.getChannels() * 2,
                    baseFormat.getSampleRate(),
                    false);
            din = AudioSystem.getAudioInputStream(decodedFormat, in);
    ss.rawDataStream(decodedFormat, true, "test",0, 0, 0, 0, 0.0f); //nullpointer from here



                ss.setPitch("test", 1);
                ss.setVolume("test", 1);
                ss.play("test");
}catch (Exception e)
        {
            System.out.println(e);
        }

Pages: [1]