Package org.lwjgl.util

Examples of org.lwjgl.util.WaveData


    executeMidStreamCreationTest();
  }


  private void executeCreationTest() {
    WaveData wd = WaveData.create(filePath);
    if(wd != null) {
      System.out.println("executeCreationTest::success");
    }
  }
View Full Code Here


      System.out.println("executeCreationTest::success");
    }
  }

  private void executeBrokenCreationTest() {
    WaveData wd = WaveData.create("");
    if(wd == null) {
      System.out.println("executeBrokenCreationTest::success");
    }
  }
View Full Code Here

  }
 
  private void executeStreamCreationTest() {
    try {
      AudioInputStream ais = AudioSystem.getAudioInputStream(new File(filePath));
      WaveData wd = WaveData.create(ais);
      if(wd == null) {
        System.out.println("executeMidStreamCreationTest::success");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

     
      // skip 1/4 of the stream
      int skip = totalSize / 4;
      long skipped = ais.skip(skip);
     
      WaveData wd = WaveData.create(ais);
      if(wd == null) {
        System.out.println("executeMidStreamCreationTest::success");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

    scratchBuffer.rewind().position(0).limit(1);
    AL10.alGenBuffers(scratchBuffer);
    buffers[bufferIndex] = scratchBuffer.get(0);

    // load wave data from buffer
    WaveData wavefile = WaveData.create("spaceinvaders/" + path);

    // copy to buffers
    AL10.alBufferData(buffers[bufferIndex], wavefile.format, wavefile.data, wavefile.samplerate);

    // unload file again
    wavefile.dispose();

    // return index for this sound
    return bufferIndex++;
  }
View Full Code Here

          // pass directly to buffer data
          AL10.alBufferData(buffers.get(0), AL10.AL_FORMAT_VORBIS_EXT, filebuffer, -1);
          filebuffer.clear();
        } else {
          // load wave data from buffer
          WaveData wavefile = WaveData.create(filebuffer.array());

          //copy to buffers
          AL10.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate);
       
          //unload file again
          wavefile.dispose();       
        }
       
        // check for errors
        if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
            exit(lastError);
View Full Code Here

    // load sound files (left, center, right).wav
    LWJGLUtil.log("Loading soundfiles...");

    LWJGLUtil.log("Loading left.wav");
    WaveData left = WaveData.create("left.wav");
    alBufferData(soundBuffers.get(LEFT), left.format, left.data, left.samplerate);
    alSourcef(soundSources.get(LEFT), AL_PITCH, 1.0f);
    alSourcef(soundSources.get(LEFT), AL_GAIN, 1.0f);
    alSource(soundSources.get(LEFT), AL_POSITION, leftPosition);
    alSource(soundSources.get(LEFT), AL_VELOCITY, leftVelocity);
    alSourcei(soundSources.get(LEFT), AL_BUFFER, soundBuffers.get(LEFT));
    alSourcei(soundSources.get(LEFT), AL_LOOPING, AL_TRUE);

    LWJGLUtil.log("Loading center.wav");
    WaveData center = WaveData.create("center.wav");
    alBufferData(soundBuffers.get(CENTER), center.format, center.data, center.samplerate);
    alSourcef(soundSources.get(CENTER), AL_PITCH, 1.0f);
    alSourcef(soundSources.get(CENTER), AL_GAIN, 1.0f);
    alSource(soundSources.get(CENTER), AL_POSITION, centerPosition);
    alSource(soundSources.get(CENTER), AL_VELOCITY, centerVelocity);
    alSourcei(soundSources.get(CENTER), AL_BUFFER, soundBuffers.get(CENTER));
    alSourcei(soundSources.get(CENTER), AL_LOOPING, AL_TRUE);

    LWJGLUtil.log("Loading right.wav");
    WaveData right = WaveData.create("right.wav");
    alBufferData(soundBuffers.get(RIGHT), right.format, right.data, right.samplerate);
    alSourcef(soundSources.get(RIGHT), AL_PITCH, 1.0f);
    alSourcef(soundSources.get(RIGHT), AL_GAIN, 1.0f);
    alSource(soundSources.get(RIGHT), AL_POSITION, rightPosition);
    alSource(soundSources.get(RIGHT), AL_VELOCITY, rightVelocity);
View Full Code Here

          // pass directly to buffer data
          AL10.alBufferData(buffers.get(0), AL10.AL_FORMAT_VORBIS_EXT, filebuffer, -1);
          filebuffer.clear();
        } else {
          // load wave data from buffer
          WaveData wavefile = WaveData.create(args[0]);

          //copy to buffers
          AL10.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate);
         
          //unload file again
          wavefile.dispose();       
        }
       
        if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
            exit(lastError);
        }       
View Full Code Here

    }
  }

  private void loadSamples() throws Exception {
    AL10.alGetError();
    WaveData data = WaveData.create("ding.wav");
    for (int i = 1; i <= 10; i++) {
      AL10.alBufferData(
        buffers.get(i - 1),
        data.format,
        data.data,
        data.samplerate);

      if (AL10.alGetError() != AL10.AL_NO_ERROR) {
        System.out.println("Failed to load " + i + ".wav into buffer");
        sources.position(0).limit(4);
        AL10.alDeleteSources(sources);
        buffers.position(0).limit(10);
        AL10.alDeleteBuffers(buffers);

        alExit();
      }
    }
    data.dispose();
  }
View Full Code Here

    if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
      exit(lastError);
    }

    //load wave data
    WaveData wavefile = WaveData.create("Footsteps.wav");

    //copy to buffers
    AL10.alBufferData(
      buffers.get(0),
      wavefile.format,
      wavefile.data,
      wavefile.samplerate);
    if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
      exit(lastError);
    }

    //unload file again
    wavefile.dispose();

    //set up source input
    AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0));
    if ((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
      exit(lastError);
View Full Code Here

TOP

Related Classes of org.lwjgl.util.WaveData

Copyright © 2018 www.massapicom. 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.