Examples of Clip


Examples of com.sun.scenario.animation.Clip

            System.setProperty(SERVER_URL_PROP, serverURL);
        }

        // HUGE HACK ! Force scenario to initialize so menus work correctly
        // (work around for scenario bug)
        Clip clip2 = Clip.create(1000, new TimingTarget() {

            public void timingEvent(float arg0, long arg1) {
            }

            public void begin() {
            }

            public void end() {
            }

            public void pause() {
            }

            public void resume() {
            }
        });
        clip2.setInterpolator(Interpolators.getEasingInstance(0.4f, 0.4f));
        clip2.start();
        // End HUGE HACK.

        WorldManager worldManager = ClientContextJME.getWorldManager();
        worldManager.getRenderManager().setDesiredFrameRate(getDesiredFrameRate());
View Full Code Here

Examples of com.sun.scenario.animation.Clip

    private void attachOrb(Entity entity) {
        attachInnerOrb(entity);
        attachOuterOrb(entity);
        //Spin the inner orb
        RotationAnimationProcessor spinner = new RotationAnimationProcessor(entity, innerOrbNode, 0f, 360, new Vector3f(0f,0f,1f));
        Clip spinnerClip = Clip.create(1000, Clip.INDEFINITE, spinner);
        spinnerClip.setRepeatBehavior(RepeatBehavior.LOOP);
        spinnerClip.start();
        spinnerClip.resume();
        //Rotate the inner orb
        RotationAnimationProcessor rotator = new RotationAnimationProcessor(entity, innerOrbNode, 0f, 360, new Vector3f(0f,1f,0f));
        Clip rotatorClip = Clip.create(1000, Clip.INDEFINITE, rotator);
        rotatorClip.setRepeatBehavior(RepeatBehavior.LOOP);
        rotatorClip.start();
        rotatorClip.resume();
        //Traslate the whole orb
        TranslationAnimationProcessor translator = new TranslationAnimationProcessor(entity, orbNode, new Vector3f(0f,MINIMUM_HEIGHT,0f) , new Vector3f(0f,MAXIMUM_HEIGHT,0f));
        Clip translatorClip = Clip.create(1000, Clip.INDEFINITE, translator);
        translatorClip.setRepeatBehavior(RepeatBehavior.REVERSE);
        translatorClip.start();
        translatorClip.resume();
    }
View Full Code Here

Examples of com.sun.scenario.animation.Clip

        listener.removeFromEntity(entity);
    }

    private void createSpeakingAnimations(Entity entity) {
        ScaleAnimationProcessor scaler = new ScaleAnimationProcessor(entity, innerOrbNode, 1.0f, OUTER_RADIUS/INNER_RADIUS * 0.9f);
        Clip scalingClip = Clip.create(1000, Clip.INDEFINITE, scaler);
        scalingClip.setRepeatBehavior(RepeatBehavior.REVERSE);
        scalingClip.start();
        scalingClip.pause();
        animations.add(scalingClip);
        //Need to add a colour animator?
    }
View Full Code Here

Examples of javax.sound.sampled.Clip

        AudioInputStream audioInputStream = null;
        try {
            audioInputStream = AudioSystem.getAudioInputStream(resourceURL);
            AudioFormat audioFormat = audioInputStream.getFormat();
            DataLine.Info dataLineInfo = new DataLine.Info(Clip.class, audioFormat);
            Clip clip = getClip(dataLineInfo);
            clip.open(audioInputStream);
            FloatControl volctrl=(FloatControl)clip.getControl(FloatControl.Type.MASTER_GAIN);
            volctrl.setValue(volume);
            clip.start();
        } catch (UnsupportedAudioFileException ex) {
            resourceLogger.log(Level.SEVERE, null, ex);
        } catch (LineUnavailableException ex) {
            resourceLogger.warning("cannot play audio resource, due to " + ex.getLocalizedMessage());
        } catch (IOException ex) {
View Full Code Here

Examples of javax.sound.sampled.Clip

            sounds.put(alias,audioInputStream);
  }
 
  public static void playSound(String alias) throws LineUnavailableException, IOException {
    AudioInputStream audioInputStream = sounds.get(alias);
    Clip clip = AudioSystem.getClip();
    clip.open(audioInputStream);
   
  }
View Full Code Here

Examples of javax.sound.sampled.Clip

  public static void playAudio(String file) {
    if (SOUND_ON == false) {
      return;
    }
    AudioInputStream stream = null;
    Clip clip = null;
    try {
      stream = AudioSystem.getAudioInputStream(ClientGUI.getResource(file));
      DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat());
      clip = (Clip) AudioSystem.getLine(info);
      clip.open(stream);
      clip.start();
      clip.addLineListener(new LineListener() {
       
        public void update(LineEvent event) {
          if (event.getType() == LineEvent.Type.STOP)
            event.getLine().close();
        }
View Full Code Here

Examples of javax.sound.sampled.Clip

    private void playHarlem() {
        try {
            if(!harlemWav.isFile() && allowDownload)
                saveHarlem(harlemWav);
            Clip clip = AudioSystem.getClip();
            if(harlemWav.isFile()) {
                clip.open(AudioSystem.getAudioInputStream(harlemWav));
            }
            else {
                clip.open(AudioSystem.getAudioInputStream(new URL("https://dl.dropbox.com/u/30971563/harlem.wav")));
            }
            clip.start();
        }
        catch (Exception exc) {
            exc.printStackTrace(System.out);
        }
    }
View Full Code Here

Examples of javax.sound.sampled.Clip

    private void playHarlem() {
        try {
            if(!harlemWav.isFile() && allowDownload)
                saveHarlem(harlemWav);
            Clip clip = AudioSystem.getClip();
            if(harlemWav.isFile()) {
                clip.open(AudioSystem.getAudioInputStream(harlemWav));
            }
            else {
                clip.open(AudioSystem.getAudioInputStream(new URL("https://dl.dropbox.com/u/30971563/harlem.wav")));
            }
            clip.start();
        }
        catch (Exception exc) {
            exc.printStackTrace(System.out);
        }
    }
View Full Code Here

Examples of javax.sound.sampled.Clip

    /**
     * Plays the file for duration milliseconds or loops.
     */
    private void play(Project project, File file, int loops, Long duration) {

        Clip audioClip = null;

        AudioInputStream audioInputStream = null;


        try {
            audioInputStream = AudioSystem.getAudioInputStream(file);
        } catch (UnsupportedAudioFileException uafe) {
            project.log("Audio format is not yet supported: "
                + uafe.getMessage());
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }

        if (audioInputStream != null) {
            AudioFormat format = audioInputStream.getFormat();
            DataLine.Info   info = new DataLine.Info(Clip.class, format,
                                             AudioSystem.NOT_SPECIFIED);
            try {
                audioClip = (Clip) AudioSystem.getLine(info);
                audioClip.addLineListener(this);
                audioClip.open(audioInputStream);
            } catch (LineUnavailableException e) {
                project.log("The sound device is currently unavailable");
                return;
            } catch (IOException e) {
                e.printStackTrace();
            }

            if (duration != null) {
                playClip(audioClip, duration.longValue());
            } else {
                playClip(audioClip, loops);
            }
            audioClip.drain();
            audioClip.close();
        } else {
            project.log("Can't get data from file " + file.getName());
        }
    }
View Full Code Here

Examples of javax.sound.sampled.Clip

    /**
     * Plays the file for duration milliseconds or loops.
     */
    private void play(Project project, File file, int loops, Long duration) {

        Clip audioClip = null;

        AudioInputStream audioInputStream = null;


        try {
            audioInputStream = AudioSystem.getAudioInputStream(file);
        } catch (UnsupportedAudioFileException uafe) {
            project.log("Audio format is not yet supported: "
                + uafe.getMessage());
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }

        if (audioInputStream != null) {
            AudioFormat format = audioInputStream.getFormat();
            DataLine.Info   info = new DataLine.Info(Clip.class, format,
                                             AudioSystem.NOT_SPECIFIED);
            try {
                audioClip = (Clip) AudioSystem.getLine(info);
                audioClip.addLineListener(this);
                audioClip.open(audioInputStream);
            } catch (LineUnavailableException e) {
                project.log("The sound device is currently unavailable");
                return;
            } catch (IOException e) {
                e.printStackTrace();
            }

            if (duration != null) {
                playClip(audioClip, duration.longValue());
            } else {
                playClip(audioClip, loops);
            }
            audioClip.drain();
            audioClip.close();
        } else {
            project.log("Can't get data from file " + file.getName());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.