Examples of AudioDevice


Examples of com.badlogic.gdx.audio.AudioDevice

      }
    }
  }

  public AudioDevice newAudioDevice (int sampleRate, final boolean isMono) {
    if (noDevice) return new AudioDevice() {
      @Override
      public void writeSamples (float[] samples, int offset, int numSamples) {
      }

      @Override
View Full Code Here

Examples of com.badlogic.gdx.audio.AudioDevice

      }
    }
  }

  public AudioDevice newAudioDevice (int sampleRate, final boolean isMono) {
    if (noDevice) return new AudioDevice() {
      @Override
      public void writeSamples (float[] samples, int offset, int numSamples) {
      }

      @Override
View Full Code Here

Examples of javazoom.jl.player.AudioDevice

    }

//    if (!ret)
    {
      // last frame, ensure all data flushed to the audio device.
      AudioDevice out = audio;
      if (out != null)
      {
//        System.out.println(audio.getPosition());
        out.flush();
//        System.out.println(audio.getPosition());
        synchronized (this)
        {
          complete = (!closed);
          close();
View Full Code Here

Examples of javazoom.jl.player.AudioDevice

   * Cloases this player. Any audio currently playing is stopped
   * immediately.
   */
  public synchronized void close()
  {
    AudioDevice out = audio;
    if (out != null)
    {
      closed = true;
      audio = null;
      // this may fail, so ensure object state is set up before
      // calling this method.
      out.close();
      lastPosition = out.getPosition();
      try
      {
        bitstream.close();
      }
      catch (BitstreamException ex)
View Full Code Here

Examples of javazoom.jl.player.AudioDevice

   */
  protected boolean decodeFrame() throws JavaLayerException
  {
    try
    {
      AudioDevice out = audio;
      if (out == null) return false;

      Header h = bitstream.readFrame();
      if (h == null) return false;

      // sample buffer set when decoder constructed
      SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bitstream);

      synchronized (this)
      {
        out = audio;
        if(out != null)
        {
          out.write(output.getBuffer(), 0, output.getBufferLength());
        }
      }

      bitstream.closeFrame();
    }
View Full Code Here

Examples of javazoom.jl.player.AudioDevice

  public void playStreaming(String path) {
    if (isPlaying)
      return;
    try {
      AudioDevice dev = getAudioDevice();
      player = new Player(getURLInputStream(path), dev);
      isPlaying = true;
      player.play();
      in.close();
      LOGGER.debug("------------------------------------------------- FIM DO PLAY");
View Full Code Here

Examples of javazoom.jl.player.AudioDevice

    }

//    if (!ret)
    {
      // last frame, ensure all data flushed to the audio device.
      AudioDevice out = audio;
      if (out != null)
      {
       
//        System.out.println(audio.getPosition());
        out.flush();
//        System.out.println(audio.getPosition());
        synchronized (this)
        {
          complete = (!closed);
          close();
View Full Code Here

Examples of javazoom.jl.player.AudioDevice

   */
  public int getPosition()
  {
    int position = lastPosition;
   
    AudioDevice out = audio;   
    if (out!=null)
    {
      position = out.getPosition()
    }
    return position;
  }
View Full Code Here

Examples of javazoom.jl.player.AudioDevice

   * Closes this player. Any audio currently playing is stopped
   * immediately.
   */
  public synchronized void close()
  {
    AudioDevice out = audio;
    if (out != null)
    {
      closed = true;
      audio = null;
      // this may fail, so ensure object state is set up before
      // calling this method.
      out.close();
      lastPosition = out.getPosition();
      try
      {
        bitstream.close();
      }
      catch (BitstreamException ex)
View Full Code Here

Examples of javazoom.jl.player.AudioDevice

   */
  protected boolean decodeFrame() throws JavaLayerException
  {
    try
    {
      AudioDevice out = audio;
      if (out == null) return false;

      Header h = bitstream.readFrame();
      if (h == null) return false;

      // sample buffer set when decoder constructed
      SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bitstream);
      short amplitude = 0;
      for(int i = 1; i < output.getBuffer().length; i++) {
          output.getBuffer()[i] = (short) (output.getBuffer()[i] * volume);
       
        if(output.getBuffer()[i] > amplitude) {
          amplitude = output.getBuffer()[i];
        }
      }
     
     
      if(amplitudeListener != null) {
        amplitudeListener.getAmplitude(amplitude);
      }
     
      synchronized (this)
      {
        out = audio;
        if(out != null)
        {
          out.write(output.getBuffer(), 0, output.getBufferLength());
        }
      }

      bitstream.closeFrame();
    }
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.